Problem with matrix4 degrees

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
hoffhoff
Posts: 17
Joined: Fri Mar 10, 2006 11:55 am

Problem with matrix4 degrees

Post by hoffhoff »

Hello,
I´m doing the transform event callback for Newton like this:

void _cdecl CObject::SetMeshTransformEvent(const NewtonBody* body, const dFloat* matrix)
{
//std::cout << "Called SetMeshTransformEvent in cobject \n";
// copy the matrix into an irrlicht matrix4
matrix4 mat;
vector3df euler;
CObject* object;
mat.makeIdentity();
memcpy(mat.M, matrix, sizeof(float)*16);

// Retreive the user data attached to the newton body
object = (CObject*) NewtonBodyGetUserData (body);
IAnimatedMeshSceneNode *tmp = object->getscenenode();

// a character is not supposed to answer to torque events
if (object->ObjectType == CHARACTER)
mat.setRotationDegrees(tmp->getRotation());

NewtonGetEulerAngle (&mat.M[0], &euler.X);

if (tmp)
{
// Position the node
tmp->setPosition(mat.getTranslation() * NewtonToIrr); // set position
tmp->setRotation(euler * (180.0f / 3.1416f)); // and rotation
}
}

Well, my problem is that I cannot set a value smaller than -90 and bigger than 90 degrees for the matrix. Then my mesh can only rotate between 180 degrees.

I asked it in the other forum and someone told me to read the help.
Please, I´ve read that help file a hundred times and I can´t solve the problem. I´m on it for weeks =\

Do someone know what should I do?

Thank you!
Post Reply