[ODE] vector force
Daniel K. O.
danielko.listas at gmail.com
Fri Feb 2 13:06:17 MST 2007
elekis escreveu:
> the only function I found is dBodyAddForce (Box,a,b,c);.
> but we have to calculate the a,b,c.
> is there any function like that putForce(BoxA,boxB,10) who put a force
> from
> A to B with 10 unit???
>
> [...]
>
> I don't see how to calculate a, b, c for dBodyAddForce (B,a,b,c);
> without
> sinus and cosinus.(maybe my physics is a little old)
> is someone can help me?
You may find useful some Linear Algebra tutorials on GameDev.net. They
are currently doing maintenance on the server, but make sure to check it
later.
To get a vector V that points from point A to point B:
V = ( B.x - A.x , B.y - A.y , B.z - A.z )
Done. The vector's length L is proportional to the euclidean distance
between A and B. That is:
L = sqrt(V.x^2 + V.y^2 + V.z^2)
If you divide each component in V by L, you get a "normalized vector"
V', that has the same direction as V, but with length 1.
V' = ( V.x/L , V.y/L , V.z/L )
Now, if you want a vector W with length 10, just multiply each component
in V' by 10:
W = ( V'.x*10 , V'.y*10 , V'.z*10 )
--
Daniel K. O.
More information about the ODE
mailing list