|Raydium 3D Game Engine
|How to get the angle between two vectors?
|Page 1 of 1|
|Author:||vicentecarro [ Thu Aug 02, 2007 4:33 pm ]|
|Post subject:||How to get the angle between two vectors?|
In my tests with planes i have a new need. I want to know the inclination that a plane has according the movement vector (not always necessary 100% forward).
The full idea is:
The plane can be though like a plane square. If that square is moving forward the collision with the air will be zero, cause they are (aprox) parallel each other.
But as much inclination have that square(the plane changes direction) more intense will be the friction with the air, cause the square and the air are going more and more perpendicular.
I want to get this value to add a force perpendicular to the plane with the function of brake the plane in the air according the air friction.
Maybe is not too well explained...
I want to know the angle between the vector of the movement and the orientation of the plane. "Just" that.
|Author:||Xfennec [ Tue Aug 07, 2007 8:51 pm ]|
You can ask an element its linear velocity, using something like "raydium_ode_element_linearvelocity_get()", then it's just a matter of math to substract this vector to the plane orientation vector ("raydium_ode_element_RelPointPos()" can do the trick, for example).
I may have missed your question, let me know if it's the case
|Author:||vicentecarro [ Wed Aug 08, 2007 9:22 am ]|
Ok, but maybe the problem are the maths(my algebra is a bit basic).
|Author:||ouille [ Wed Aug 08, 2007 9:46 am ]|
Even if it's in french, have a look to this page:
this code get plane velocity and translate to local :
dReal *v = dBodyGetLinearVel(bodycorp);
dBodyVectorFromWorld(bodycorp, v, v, v, localv);
it's direct hit to ode, but this code should work.
i'll send you entire source code in september ! sure !
|Author:||Xfennec [ Wed Aug 08, 2007 2:47 pm ]|
Yep. And this may help you a bit to make it a bit more using RayODE:
We should probably wrap dBodyVectorFromWorld() in ode.c.
|Page 1 of 1||All times are UTC|
|Powered by phpBB® Forum Software © phpBB Group