Page 1 of 1

projectile simulation

Posted: Mon Feb 01, 2010 8:21 am
by jaybell77
Hello,
I'm trying to simulate a projectile (like an arrow or a missile). I add a smaller weight head to the main body (attached to as a joint), so it's weighted in the front. For the most part, it works and achieves the arced/angled shot I want. However, when I shoot it straight up in the air, it doesn't rotate when it reaches its peak (so that the head is now facing down to the ground when falling). Is this something I have to manually do myself, or is it just my weight-ratio needs tweaking?

thanks for any help

Re: projectile simulation

Posted: Mon Feb 01, 2010 9:27 am
by slembcke
A real missile angles itself like that because it has fins on the back that add drag and keep it pointed straight. So you will either have to add drag forces, or set the angle to match the velocity. I'd just set the angle personally.

Code: Select all

cpBodySetAngle(body, cpvtoangle(body->v));

Re: projectile simulation

Posted: Mon Feb 01, 2010 11:40 am
by jaybell77
thanks, much appreciated!