Projectiles using Oops (Creating RigidBody dynmaically, removing them etc.)

Dec 18, 2007 at 2:17 PM

How can I create a projectile using Oops? I figure that would require me to create a RigidBody dynamically and add it on to the collision space. How then should I safely remove them from the collision space?

Thanks so much in advance!
Dec 19, 2007 at 1:36 PM
If you want your projectile to abide by the laws of physics (i.e., affected by gravity and other forces), then what you've stated above seems logical to me, although you may want to create some sort of object pool for performance reasons. You can remove a CollisionShape form the quad-tree using the Remove method.

If the projectile if fast-moving, a ray intersection test is probably necessary. Unforntunately, ray collision isn't fully implemented yet. I believe sphere-ray collisions work though.

If the projectile doesn't really abide by the laws of physics and all you want to determine is if a collision occurred, you could use one instance of a CollisionShape/Rigid Body and move it to each of the projectile's positions before checking for a collision.

Hope that helps!!