Sign in to follow this  

Importing 3ds Max data into LH coord system

Recommended Posts

Hi. I'm using 3ds Max 8 to model both a skinned mesh and the AGIEA PhysX actors. I use Jon Watts' excellent KW X-port to export the frame hierachy to .x file, and the PhysX max plugin to export the actors to an .xml file. When I load the .x file everything is in order, but loading the PhysX data is a problem and I believe it has to do with the conversion to the LH coord system. Here is a simplified version of my PhysX model in Max: Brutus_max Notice that x-right, y-in, z-up. Also notice that the left foot is missing. When I load this physX data into the PhysX Viewer, look at the results: Brutus_physx Notice that the coord system is different, (y & Z have changed places) and the actors load in a different position. This new orientation makes sense because of the change in y & z. Notice also that the RIGHT FOOT appears to be missing now, when it was the left that was missing from the 3ds max model. This tells me that the model is not only re-oriented, but it is also being mirrored across the yz plane. I need help in knowing how to manipulate the physX data such that it is correctly loaded into the new coord system. Tons of similar questions have been posed here and around the net, but I've not had luck adapting those answers to my situation. Here is what I've tried: Note: this is the code to load each actor. the NxMat34 matrix is made of of a rotation matrix (M) and the translation vector (t). First I tried to flip the y and z axis and negate the x...
bool	NXU_preNotifyActor(NxActorDesc &actor, const char	*userProperties)
          NxMat33 M = actor.globalPose.M;
	  NxVec3 t = actor.globalPose.t;

	  //negate the x row...
	  M.setRow(0, -actor.globalPose.M.getRow(0));
	  //swap the y and z rows...
	  M.setRow(1, actor.globalPose.M.getRow(2));
	  M.setRow(2, actor.globalPose.M.getRow(1));

	  //negate the x position...
	  t.x *= -1;
	  //swap the y and z positions...
	  NxReal temp = t.y;
	  t.y = t.z;
	  t.z = temp;
          actor.globalPose.M = M;
	  actor.globalPose.t = t;
This modification results in this: Brutus_fix1 It is now upright, but it is still mirrored along the x axis. If I don't negate the x axis in the code above, I get a mangled mess... Anyone know what I'm missing?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this