PDA

View Full Version : realistic movement along path



kamcknig
June 6th, 2009, 09:24 PM
Hi everyone,

I'm making a game that involves spaceships following waypoints. Rather than making them move straight to a waypoint, turning, and then moving straight to the next one, it'd be nice to have them follow some sort of bezier curve/path along all of the waypoints. I'm not familiar with the math involved in this kind of thing. Are there any tutorials or sites out there that you guys know of that you can point me to in order to get something like this working?

Thanks!
Kyle

Dom_
June 6th, 2009, 11:00 PM
Check out http://blog.greensock.com/tweenmaxas3/
it has built in bezier support

kamcknig
June 7th, 2009, 01:18 AM
That's pretty close to what I need!

Is there any way though to make it speed based versus time based? If the object is going at, arbitrarily, 10 pixels per second, I'd have to do some math to figure out the time it would take to get to a place in order to use this I assume.

Thanks for the pointer!

BenBart
June 7th, 2009, 01:53 AM
That's pretty close to what I need!

Is there any way though to make it speed based versus time based? If the object is going at, arbitrarily, 10 pixels per second, I'd have to do some math to figure out the time it would take to get to a place in order to use this I assume.

Thanks for the pointer!
Or, you can use the onComplete event that it dispatches when the tween is done.

kamcknig
June 7th, 2009, 07:51 AM
Or, you can use the onComplete event that it dispatches when the tween is done.


huh? how does that help with making it speed based rather than time based?