Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 15th Mar 2003 19:19
right so im tryin to use the mouse for movement in my game (kinda isometric i guess) but me being retarded at math i cant get the angles right..... im usin the x and y coords of the mouse and for some reason i cant figure out how to make the object turn to where the mouse is when you click...
math sucks
Shadow
22
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 15th Mar 2003 22:08
If you've got DarkBASIC Pro, use the atanfull() command.

p.s. if you think math sucks, you'll have a hard time programming anything decent.
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 16th Mar 2003 00:56
ya ya dont worry i just get frustrated sometimes with math

i dont really think it sucks

matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 16th Mar 2003 01:04
hmm tried it still not working.... i might not be using it right

i have my mousex in a variable and my mousey in a variable
then i have
newangle# = atanfull(xvar#,yvar#)
cangle# = curveangle(newangle#,cangle#,10)
yrotate object 1, ca#

any ideas?
btw its turning but not in the direction i wanted.

Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 16th Mar 2003 02:11
Is it turning in the opposite direction? If so, then just change newangle# to a negative value.

newangle# = 0 - newangle#

That will only work if it's turning in the opposite direction, I don't have DBPro so I can't go into the actual use of the function any further, sorry.

"Computers are useless they can only give you answers."
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 16th Mar 2003 02:27
its kinda wierd
its turning in the wrong direction for about 1/3 the way around the screen, then it just goes back and forth about 10-20 degrees left or right of that spot no matter where i move the mouse

Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 16th Mar 2003 03:03
atanfull requres the x distance and y distance

use:

newangle# = atanfull(objx#-xvar#,objy#-yvar#)
(obj is object u wanna rotate - bet u guessed that )
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 16th Mar 2003 03:07
hang on - u in 3d?
i thought you was doing 2d

not sure a tanfull will work - mouse position 2d - object in a 3d world.
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 16th Mar 2003 03:11
u could have a yangle# variable that changes with mouse movements x - and then when you click yrotate the object to yangle#

or do you wanna click the mouse pointer on the screen and get object to point at that position?
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 16th Mar 2003 06:34
ya i was trying to set it up so it used the center coordinate of the screen and the mouse click position to generate the angle to turn the player but i just dont know how to get it right... ill keep trying any more ideas are greatly appreciated
thanks guys

matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 16th Mar 2003 06:59
got it!

angle# = atanfull((screen height()/2)-mox#,(screen width()/2)-moz#)
angle# = 0-angle#

works perfectly
thanks everyone for ur help

Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 16th Mar 2003 13:13
nice work

you owe maths an appology

Login to post a reply

Server time is: 2024-11-12 23:59:13
Your offset time is: 2024-11-12 23:59:13