IrrNewt - strange rotation
IrrNewt - strange rotation
Hi,
I use IrrNewt with my project and now I have a problem:
Maybe some of you knows the IrrNewt example with the car.
But how can I get the Y-Rotation if the car? I tried it with "chassis_node->getRotation().Y" but then I get a value between 270 and 90 degrees, so if the rotation is 90, it counts backwards, the same procedure if I reach 270 degrees.
The value is never between 90 and 270, so for example its impossible to reach 180 degrees.
Anaway, the car moves and rotates correctly, only the "getRotation()"-Value is wrong.
How can this be?
I need the real Y-rotation, because I want to create a third person cam.
Donner
I use IrrNewt with my project and now I have a problem:
Maybe some of you knows the IrrNewt example with the car.
But how can I get the Y-Rotation if the car? I tried it with "chassis_node->getRotation().Y" but then I get a value between 270 and 90 degrees, so if the rotation is 90, it counts backwards, the same procedure if I reach 270 degrees.
The value is never between 90 and 270, so for example its impossible to reach 180 degrees.
Anaway, the car moves and rotates correctly, only the "getRotation()"-Value is wrong.
How can this be?
I need the real Y-rotation, because I want to create a third person cam.
Donner
Hello ..
Hello ..
I donot have a solve for you, but i need help.
I try to download IRRNEWT 0.4 ,but i canot .
do you can send the package irrnewt 0.4 or older into my e-mail
Alaabr9@yahoo.com
thank you overall...
________
MARIJUANA TRICHOMES
I donot have a solve for you, but i need help.
I try to download IRRNEWT 0.4 ,but i canot .
do you can send the package irrnewt 0.4 or older into my e-mail
Alaabr9@yahoo.com
thank you overall...
________
MARIJUANA TRICHOMES
Last edited by AlaaBR9 on Fri Feb 25, 2011 2:41 am, edited 1 time in total.
Hi,
i sent irrlicht to you as email attachment.
Well, back to topic:
I found out that, when the Y Rotation should change from 89.9... to 90 or heigher (it goes back to 89.9..., 89.8 ), the X- and Z Rotation change from (ca.) 0 degrees to ca. 180 degrees, but the Mesh doesnt change.
Hmm... my english isnt very good so its not esay to explain the problem... Well, I made a little drawing:
http://imageupload.com/out.php/i46836_i ... roblem.png
Here you can see the Y Rotation of the car. The black numbers stand for the Y Rotation, which is returned by "playermesh->getRotation().Y". The red numbers stand for the "real" rotation, but, as I said above, I get the wrong (black) values.
And if the 90° or the 270° are reached, the X-Rotation changes from 0 degrees to 180 degrees, exactly as the Z-Rotation.
How can it be?? What could IrrNewt/Newton do? I think its a question which regards Irrlicht and not only IrrNewt, so I hope I get an answer...
Donner
i sent irrlicht to you as email attachment.
Well, back to topic:
I found out that, when the Y Rotation should change from 89.9... to 90 or heigher (it goes back to 89.9..., 89.8 ), the X- and Z Rotation change from (ca.) 0 degrees to ca. 180 degrees, but the Mesh doesnt change.
Hmm... my english isnt very good so its not esay to explain the problem... Well, I made a little drawing:
http://imageupload.com/out.php/i46836_i ... roblem.png
Here you can see the Y Rotation of the car. The black numbers stand for the Y Rotation, which is returned by "playermesh->getRotation().Y". The red numbers stand for the "real" rotation, but, as I said above, I get the wrong (black) values.
And if the 90° or the 270° are reached, the X-Rotation changes from 0 degrees to 180 degrees, exactly as the Z-Rotation.
How can it be?? What could IrrNewt/Newton do? I think its a question which regards Irrlicht and not only IrrNewt, so I hope I get an answer...
Donner
Well I still have the same problem. And I asked the community some months ago without any answer. You can read my post here http://irrlicht.sourceforge.net/phpBB2/ ... highlight=
either the problem is in my/our rotation function or in irrlicht. It would be really nice if someone could check this and give us feedback!
@Donner: how does your rotation function look like?
best regards!
either the problem is in my/our rotation function or in irrlicht. It would be really nice if someone could check this and give us feedback!
@Donner: how does your rotation function look like?
best regards!
Upps, sorry I didn' response earlier.
This is not a irrnewt problem, if I remember well is the way irrlicht manage rotation wit euler angles. (Look for euler angles, I learned this a little time ago too).
Well I think you can rotate your bodies doing:
matrix4 mat;
mat.serRotationDegrres(278) //an example )
bodyPhysic.setRotation(mat.getRotation);
I don't know if this works.
if not, try:
matrix4 mat;
mat.serRotationRadians(angleInRandias)
bodyPhysic.setRotation(mat.getRotation);
I repeat, this is not a irrnewt problem, this is basic from irrlicht (that I don't know how to solve ).
I hope it help you. Tell me if you find the solution.
This is not a irrnewt problem, if I remember well is the way irrlicht manage rotation wit euler angles. (Look for euler angles, I learned this a little time ago too).
Well I think you can rotate your bodies doing:
matrix4 mat;
mat.serRotationDegrres(278) //an example )
bodyPhysic.setRotation(mat.getRotation);
I don't know if this works.
if not, try:
matrix4 mat;
mat.serRotationRadians(angleInRandias)
bodyPhysic.setRotation(mat.getRotation);
I repeat, this is not a irrnewt problem, this is basic from irrlicht (that I don't know how to solve ).
I hope it help you. Tell me if you find the solution.
Ok but I think that is what I made with my matrixRotation function, to change the excisting rotation of a node with a new one:
...or how does your function look like ?
Code: Select all
// set the rotation between to euler angel vectors
core::vector3df matrixRotation(core::vector3df rotation, core::vector3df newrot)
{
f32 pitch=newrot.X;
f32 yaw=newrot.Y;
f32 roll=newrot.Z;
core::matrix4 m,t;
m.setRotationDegrees(rotation);
t.setRotationDegrees(core::vector3df(pitch,0,0));
m*=t;
t.setRotationDegrees(core::vector3df(0,0,roll));
m*=t;
t.setRotationDegrees(core::vector3df(0,yaw,0));
t=m*t;
return t.getRotationDegrees();
}
Sorry about the my code kinda sucks.
Believe or not I have not use rotations yet . I am for example rotating my tank turret with angular velocity, same for cannon, etc.
But do you try this ?
matrix4 mat;
mat.setRotationDegrees(vector3df(0,rotationY,0));
body->setRotation(mat.getRotationDegrees());
I just tried it and it works in irrlicht 360 without problem.
In irrnewt becasue you have friction you have to deal with what happend if you try to rotate a body with other forces, like gravitiy, friction, etc.
So in irrnewt I try to do the same and didn¡'t work (it rotates but slides becase other forces).
So if you wanto to rotate a body you shold freeze it and then unfreeze.
Or other kind of solution that don't affect the body with forces (at least friction) while rotating it. This will work.
I hope it help you.
By the way, good skeletal animation, but I am having problem with instaliling acky extansion so I have couldn't put it in my proyect.
Believe or not I have not use rotations yet . I am for example rotating my tank turret with angular velocity, same for cannon, etc.
But do you try this ?
matrix4 mat;
mat.setRotationDegrees(vector3df(0,rotationY,0));
body->setRotation(mat.getRotationDegrees());
I just tried it and it works in irrlicht 360 without problem.
In irrnewt becasue you have friction you have to deal with what happend if you try to rotate a body with other forces, like gravitiy, friction, etc.
So in irrnewt I try to do the same and didn¡'t work (it rotates but slides becase other forces).
So if you wanto to rotate a body you shold freeze it and then unfreeze.
Or other kind of solution that don't affect the body with forces (at least friction) while rotating it. This will work.
I hope it help you.
By the way, good skeletal animation, but I am having problem with instaliling acky extansion so I have couldn't put it in my proyect.
The turnRight function only moves the steer angle for the front wheels.
Take a look at the implementation of this function on the car file.
But I don't undertand why have you problem with this if this not use any kind of angle, it only turns the wheel and icrement angle (transparent to you) and because the MAX-STEERANGLE don't let the wheel turn more than 90 degrees (if I remember correctly).
What do you in fact want to do?
Turn the car?, turn the wheel?, or something else?
Take a look at the implementation of this function on the car file.
But I don't undertand why have you problem with this if this not use any kind of angle, it only turns the wheel and icrement angle (transparent to you) and because the MAX-STEERANGLE don't let the wheel turn more than 90 degrees (if I remember correctly).
What do you in fact want to do?
Turn the car?, turn the wheel?, or something else?
Try this or something like this.
matrix4 mat;
mat.setRotationDegrees(car->getRotationBody());
body->setRotation(mat.getRotationDegrees());
(But I think it will do the same that if camera will be a child of car).
What is exactly what you want to do?
Do you want to change the target of the camera????
This MUST BE DONE with camera-SetTarget(target).
You can create the targe vector in this way:
vector3df target = vector3df(0,0,1) //THIS ASSUME that you begin with the face of your car facing z axis +.
Then if you want to move the camera target for 45 degrees left of car
you will do something like this:
matrix4 mat;
mat.setRotationDegrees(car->getRotationBody()+vector3df(0,-45 ,0);
mat.rotateVect(target);
camera->setTarget(target);
Please correctme someone if this doesn't work, in particular de part in wich I set the rotationDegrees to the matrix (this one I have doubts):
matrix4 mat;
mat.setRotationDegrees(car->getRotationBody());
body->setRotation(mat.getRotationDegrees());
(But I think it will do the same that if camera will be a child of car).
What is exactly what you want to do?
Do you want to change the target of the camera????
This MUST BE DONE with camera-SetTarget(target).
You can create the targe vector in this way:
vector3df target = vector3df(0,0,1) //THIS ASSUME that you begin with the face of your car facing z axis +.
Then if you want to move the camera target for 45 degrees left of car
you will do something like this:
matrix4 mat;
mat.setRotationDegrees(car->getRotationBody()+vector3df(0,-45 ,0);
mat.rotateVect(target);
camera->setTarget(target);
Please correctme someone if this doesn't work, in particular de part in wich I set the rotationDegrees to the matrix (this one I have doubts):