|
-
Dec 12th, 2006, 09:57 AM
#1
[Resolved]Getting angle of movement in radians via mouse
Hey guys. I am really trying to wrap my head around this. What I am trying to get done is when the mouse is moved, I need to calculate the degree in radians it moved based on the local coordinate space of a sprite the mouse is moving. Basically I need to fire a bullet in that direction when I hit the fire button. I know how to animate it and all that, but just can't figure out how to get the radians based on mouse movement.
Hope I explained that well enough. Think Geometry Wars as far as how I need to be firing the bullets. Any tips?
I will eventually be using a 360 controller using the left stick for this, but for the time being I need to do this with a mouse for testing stuff at work where I don't dare bring in a game controller.
Last edited by Cander; Dec 12th, 2006 at 12:13 PM.
-
Dec 12th, 2006, 10:19 AM
#2
Re: [Any language]Getting angle of movement in radians via mouse
I'd use the mousemovement event to get the X and Y value, compared against the last X and Y values (which you need to store in a global var), you can calculate the DeltaX and DeltaY.
Where is your problem, how the get those DeltaX and DeltaY or how to calculate the radians from DeltaX and DeltaY?
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Dec 12th, 2006, 10:26 AM
#3
Re: [Any language]Getting angle of movement in radians via mouse
Getting the DeltaX and Y is my issue. I know how to get the radians.
My math is so rusty. Boo to getting old.
-
Dec 12th, 2006, 12:08 PM
#4
Re: [Any language]Getting angle of movement in radians via mouse
Hey man thanks. Just by what you said after thinking about it I figured it out. Rep coming your way.
-
Dec 12th, 2006, 03:08 PM
#5
-
Dec 12th, 2006, 03:18 PM
#6
Re: [Resolved]Getting angle of movement in radians via mouse
Oh snap. I am burned. 
Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|