hello,
i have a model. i need to make move. from point P1 to P2. I need to calculate the angle for the model to turn to tat vector and then i can move it.
suppose i have p1 = (0,0,0) and p2 = (10, 0, 10);
The character has to turn 45degrees to face that vector. I tried calculating the rotation angle by this but its not happening. Any help plz ??
Code:
quaternion* q = new quaternion();
vector3df resultEuler;
vector3df resultDegrees;
q->rotationFromTo(core::vector3df(0,0,0), core::vector3df(10,0,10));
q->toEuler(resultEuler);
resultDegrees = vector3df(resultEuler * RADTODEG);
....
when i run this it gives me zero vector.
rotation of model
kool.. will have a look and try implementing. the getHorizontalangle() function is easy way.alrusdi wrote:http://irrlicht.sourceforge.net/phpBB2/ ... php?t=1325
i didnt mean a null vector. its a vector of coordinates (x,y,z)hybrid wrote:You should get sensable results from your first solution as well, once you use a real vector for the first one. Just try to figure yourself how to rotate the null vector so it will become some other vector... So I guess your first vector is (0,0,10)
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Well, you called rotationFromTo(core::vector3df(0,0,0), core::vector3df(10,0,10))
which obviously uses a null vector. And this one has arguably either all rotations, or none, or whatever. At least there' no way to rotate (0,0,0) in a way that it will represent any other vector afterwards. Better use normalized vectors for quaternions...
which obviously uses a null vector. And this one has arguably either all rotations, or none, or whatever. At least there' no way to rotate (0,0,0) in a way that it will represent any other vector afterwards. Better use normalized vectors for quaternions...