[ODE] When rockets hit objects

Jon Watte hplus-ode at mindcontrol.org
Tue Feb 22 09:33:33 MST 2005



> 1) the rockets are very fast (may lose some
> collisions?)

Use a ray from source to destination for each frame.

> 2) there are lots of rockets (say, 20 at one time!)

So?

> 3) how to detect when a rocket hit some object?

You'll get the dCollide callback, and test there, just 
like any other collision.

> 4) how to identify this object?

The user data field of the body or geom the object is 
connected to.

> 5) the rockets may use boxes or spheres to detect
> collisions; which one is faster (may be a matter of I
> make some tests)?

Spheres are slightly faster. I recommend ccylinders for 
rockets, as rockets are oblong. Plus the ray sticking out 
the nose (or trailing behind the tail).

> It's possible to use only OPCODE to collision
> detection, in this case, or I must use a custom one?

Use the basic ODE system, it has all the primitives you 
need.

Carworld has source for rockets and grenades, although it 
steps the physics fast enough (100 times a second) and 
runs the rockets slow enough that a ray isn't needed.

http://www.mindcontrol.org/~hplus/carworld/

Cheers,

				/ h+




More information about the ODE mailing list