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
projectile simulation
-
- Posts: 5
- Joined: Sun Feb 08, 2009 6:32 am
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: projectile simulation
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));
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/
-
- Posts: 5
- Joined: Sun Feb 08, 2009 6:32 am
- Contact:
Re: projectile simulation
thanks, much appreciated!
Who is online
Users browsing this forum: No registered users and 43 guests