rotation bug?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

rotation bug?

Postby Luben » Thu Sep 23, 2010 5:21 pm

Hi!
When loading a level in my game, i'm building collision tree's from the model meshes. Then i add them to the scene with NewtonSceneCollisionCreateProxy, and positions them with NewtonSceneProxySetMatrix. Only problem is, that when an object is to be rotated 180 degrees around the Y axis, it appears not to work. Here's a picture illustrating the problem.
Image
As can be seen, the lamp is supposed to be facing the other way.
Here is a picture of another lamp, which is rotated -10, 180, -30. Also some other objects that are rotated correctly.
Image
Beside the lamp in pic #1, other lamps as well as a car gets their orientation ignored. All of them have rotation 0, 180, 0.

The wierdest thing is that this code makes them face the right way.
Code: Select all
inline matrix4 NewtonTransform(ISceneNode *pNode){
   matrix4 mat;
   vector3df rot = pNode->getRotation();
   if(rot == vector3df(0, 180, 0)){
      //Wierdest bugfix ever! :S
      rot = vector3df(0, 0, 0);
   }
   mat.setRotationDegrees(rot);
   mat.setTranslation(pNode->getAbsolutePosition());
   return mat;
}

I don't think this is a bug i've caused in my code. I've debugged and checked that the matrix is correctly set up before adding the wierd fix.
Luben
 
Posts: 3
Joined: Thu Sep 23, 2010 5:04 pm

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 16 guests

cron