- Home /
Curved trajectory + easing
I want to make an object follow a curved trajectory through the air, only towards the end of the curve i want it to ease to a stop. How do I do this? I tried fiddling around with forces but it doesn't give me the effect i want. Searching on google throws up bezier curves and itween, but im not sure if thats applicable to what i want.
it's neat that you tried "fiddling around" with forces. in fact, by "fiddling around" with forces, you can make video games, build suspension bridges, create Western Civilisation, etc.
so what you want is a retro-rocket that slows you to a stop just in time.
add a line of code that checks you are below a certain height. once you are below that certain height, kick in your retro rocket.
(obviously, if you also throw the object "up, then it comes down" you need to check that you are on the downward leg ... don't accidentally apply the retro rocket force when you first throw the object upwards. if you are unable to "check if velocity is downwards" you need to step back, learn the basics, and maybe ask questions about that issue)
so you check if you are heading downwards and below your "kick-in height"
at that point simply ..........apply a force upwards. remarkably, it's that easy.
using high school arithmetic, you can figure out what the force in Newtons should be. But interestingly, you can simply guess any value, and in a few tries you can get to the correct value.
simply apply the same force throughout the period where you're below the kick-in line
you're done
Answer by ZenithCode · Oct 01, 2012 at 01:21 PM
The question you should ask yourself is, What behaviour do I expect if something comes in the middle of the trajectory? If nothing, then use iTween, otherwise use physics.
I would suggest you look at iTween examples here, http://itween.pixelplacement.com/examples.php
Your answer