the direction an object is moving
-
- Posts: 2
- Joined: Mon Aug 17, 2009 5:46 pm
- Contact:
the direction an object is moving
I was wondering how to find out the direction/angle a body is moving in, not necessarily the angle it is facing. So if a ball is flying in the air, I want to know what direction it is moving, not the angle it is pointed in. Sorry if this has already been covered, but I couldn't find anything in a search about it. Thank You for the help!
-
- Posts: 2
- Joined: Mon Aug 17, 2009 5:46 pm
- Contact:
Re: the direction an object is moving
It seems I was able to solve this myself, here's what I came up with:
Seems to give me the right angle anyway. Thoughts?
Code: Select all
float tAngle;
tAngle = cpvtoangle(sBody->v);
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: the direction an object is moving
That is correct, however the result is undefined when the object is not moving. Be careful of that.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: Bing [Bot] and 14 guests