Sign in to follow this  
ankhd

Mesh Rotating around some radius for some reason

Recommended Posts

ankhd    2304
Hi there, The problem is that I have a 2 mesh objects and one mesh is the body and the other is a latch, this latch is what I am rotating and it seems to be rotating from some other centre point then that was when it was in 3DSMax9 and results in the latch rotating around the object in a big arc. Does any body know why it would be doing this. More on the mesh construction the latch is only a box with the ends turnd up Exported with the latest panderexporter How do I rotate this latch from a postion on the main body

Share this post


Link to post
Share on other sites
remigius    1172
If I understand your question correctly, this is actually expected behaviour. If you have offset the latch mesh in MAX from the coordinate center, this offset/translation will also occur in your DX program. Since a normal rotation matrix rotates the vertices around the coordinate center, the translation will result in the big arc you're seeing. It's kinda like applying a translation matrix before rotating, like this:



The easiest way to solve this issue would be to move the latch mesh to the coordinate center in MAX, so you can just applying the rotation. The downside is that you'll have to apply the offset manually in your application. This shouldn't be a big issue though, since you'll probably will be using a world matrix to position the body mesh anyway and you can easily add the offset to that for the latch mesh.

As an alternative, if the latch mesh is only offset in the vertical direction (so it's above the body object in MAX, like a tank turret for example), you shouldn't have any problems rotating the mesh around the vertical axis. This holds true for all offset axes, so if rotating around this axis is what you're trying to do, you can construct a 'rotate around axis' rotation matrix using the appropriate function. I don't know it verbatim for C++, but in MDX it's Matrix.RotationAxis(Vector3 axis, float rotation).

Hope this makes sense :)

Share this post


Link to post
Share on other sites
ankhd    2304
I fixed it. No one said that the object you export from say 3dsmax had to be in the centre of the world(0,0,0)????????????

Share this post


Link to post
Share on other sites
Mastaba    761
Quote:
Original post by ankhd
I fixed it. No one said that the object you export from say 3dsmax had to be in the centre of the world(0,0,0)????????????


It doesn't. You simply have to distinguish between object space and world space, and perform the necessary transform from one to the other when needed.

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