Raydium 3D Game Engine http://memak.raydium.org/ 

How to get the angle between two vectors? http://memak.raydium.org/viewtopic.php?f=8&t=682 
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 ] 
Post subject:  
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 ] 
Post subject:  
Ok, but maybe the problem are the maths(my algebra is a bit basic). 
Author:  ouille [ Wed Aug 08, 2007 9:46 am ] 
Post subject:  
Hello, Even if it's in french, have a look to this page: http://wiki.raydium.org/wiki/ModelPhys this code get plane velocity and translate to local : Code: dReal *v = dBodyGetLinearVel(bodycorp);
dBodyVectorFromWorld(bodycorp, v[0], v[1], v[2], localv); it's direct hit to ode, but this code should work. i'll send you entire source code in september ! sure ! Bye Ouille 
Author:  Xfennec [ Wed Aug 08, 2007 2:47 pm ] 
Post subject:  
Yep. And this may help you a bit to make it a bit more using RayODE: Code: dReal *res;
dReal resl[3]; ... res=raydium_ode_element_linearvelocity_get_name("corps"); dBodyVectorFromWorld(raydium_ode_element[raydium_ode_element_find("corps")].body,res[0],res[1],res[2],resl); We should probably wrap dBodyVectorFromWorld() in ode.c. 
Page 1 of 1  All times are UTC 
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ 