[ODE] AI steering behaviors using ODE
STenyaK (Bruno Gonzalez)
stenyak at gmx.net
Mon May 15 13:34:15 MST 2006
I'm not an expert in physics nor in maths, but assuming your force-related
code is right, and since torques are the equivalent to forces when it
comes to rotations, the code should be pretty similar: just replace
position with angle, velocity with rotational velocity, force with
torque... i think that should work.
<offtopic>así que un juego de naves espaciales en 3d... será de
estrategia? O:-)</offtopic>
On Mon, 15 May 2006 17:50:37 +0200, Raul Chaparro
<raul.chaparro at pyrostudios.com> wrote:
> 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.
--
Saludos,
STenyaK
_______________________________________________
Site: http://1ksurvivor.homeip.net <1kSurvivor>
http://motorsport-sim.org <Motorsport>
http://kwh.iespana.es <KuantikalWareHouse>
http://emuletutorial.info <EmuleTutorial>
ICQ: 153709484
Mail: stenyak AT gmail DOT net
More information about the ODE
mailing list