[ODE] AI steering behaviors using ODE
Raul Chaparro
raul.chaparro at pyrostudios.com
Mon May 15 08:50:37 MST 2006
Hello. I'm new with ODE, just trying to use it to physics needed for a 3D spaceship game. I have a problem about calculating torque of enemy ships. Perhaps my question is more about physics than ODE, but i have this problem since many weeks ago, any help would be appreciated. Thanks.
The enemy spaceships moves with steering behavior forces. Once force is calculated, physics are updated and ship moves. The problem is that resulting force is applied linearly to the Center of Mass (translation). I don't know if it is possible obtain torque from this initial force, because there is no rotation at CM.
Just now i'm not using rocket engines to get the propulsion of the ships. For example, to calculate force when ship is going towards an enemy, i do:
current velocity = ship.velocity
desired velocity = target.position - ship.position
Force = desired velocity - current velocity
I would need to find how to calculate torque based on that Force. If i imagine one engine thrust at the center bottom of the ship, applying
Torque = (CM - point of force application) X Force (X = cross product)
then i obtain one torque vector that sometimes points in wrong direction, which makes ship's rotation faces away target and not towards target. I am trying that ship's heading always points to right direction while it moves. How can i solve that?
Other solution I've thought is create many thrusters at backwards ship, all controlling torque and lineal force (for example one for each vertex of the bounding box backwards), or one controlling lineal force and the rest controlling only torque, but then, how to calculate the force to apply to each thruster based on Force value?
Again, thanks for your time.
R.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060515/67c07c70/attachment.htm
More information about the ODE
mailing list