Newton serialized collision left handed

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Newton serialized collision left handed

Postby Forthehorde » Sun Jan 05, 2014 9:45 am

I am having some problems with Newton mesh build system, It loads fine in newton mesh tool and displays fine, but in my DIrectX application the mesh does not match up the visual mesh.

Does the winding order of the faces affect the newton mesh build process?
How can I convert resulting mesh to be ok with DirectX?

I tried this but it does not work:

Code: Select all
FILE * File;
   errno_t err = fopen_s(&File, Input.c_str(), "rb");
   NewtonCollision * Collision = NewtonCreateCollisionFromSerialization(PhysicsWorld, DeSerializeFile, File);
   fclose(File);

   Matrix4 Matrix = Matrix4::createScale(1.0f, 1.0f, -1.0f);
   NewtonBody * Body = NewtonCreateDynamicBody(PhysicsWorld, Collision, &Matrix[0][0]);
   NewtonBodySetMassProperties(Body, 0.0f, Collision);
User avatar
Forthehorde
 
Posts: 26
Joined: Sun Dec 29, 2013 6:17 am

Re: Newton serialized collision left handed

Postby Julio Jerez » Sun Jan 05, 2014 11:32 am

I just pasted that code fragment into one of the demos. and while there was an error in the transform of the demo mesh, there was no bug in the newton serialization.

if you Sync to SNV and you open file, ../applications\demosSandbox\sdkDemos\toolBox\PhysicsUtils.cpp

find function
NewtonCollision* CreateCollisionTree (NewtonWorld* world, DemoEntity* const entity, int materialID, bool optimize)
and go to line 1018
change the #if 0 to #if 1

and you can see that all mesh are serialized and deserialized correctly.
my guess is that the data you passed in when you created the first mesh is not correct,

this Matrix4 Matrix = Matrix4::createScale(1.0f, 1.0f, -1.0f); is just wrong, a scale can not be negative
it has nothing to do with D3D, or left or right handed systems, newton is agnostic to the handedness of the graphic system.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 7 guests