Sign in to follow this  

[MDX] Mesh breaking up

Recommended Posts

Hi, I currently have a mesh that consists of several parts for the purpose of animating. When the mesh is stationary it looks fine - all the parts are where they should be. The problem occurs when I start to move the mesh. I am using the LoadHierarchyFromFile function to load the mesh, and am using the standard DrawMeshContainer method to draw it. I set the world transform at the same location that the MS sample does - which includes the particular parts translation etc as well as it's location in the world. When I move the model, especially at high speeds (say, 100 units every frame), the mesh starts to shake and break up. I'm guessing that this may have something to do with the precision of the units. If Eg. if the model starts at position (0,0,0), by the time it gets to (200000,0,0) it has become broken up, not too much, but it is noticable. I am using a Vector3 to store the position of the mesh, and also use it when calculating the translation matrix. Any solutions? Cheers

Share this post

Link to post
Share on other sites
If it really is a precission issue, maybe reducing the scale you use in your application just might help a little bit. Another thing worth looking into is how you calculate the matrices for the parts. Using the same global world matrix for the translation and multiplying that with the 'offset matrix' of the parts should be less prone to rounding errors (and generally more stable) than recalculating the matrices seperately for each part.

In pseudo-code, something like this:

Vector3 meshSpeed = new Vector3(1, 0, 0); // or whatever
Matrix meshWorld = Matrix.Translation( meshSpeed * timeStep );

foreach(Part p in Mesh.Parts)
Matrix partMatrix = p.BaseTransform * meshWorld;
// render with this matrix

I hope this makes some sense and is of some use [smile]

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