Collision and Render Shapes Not Aligned HELP

Ugras
Posts: 34
Joined: Wed Dec 30, 2009 8:30 pm

Collision and Render Shapes Not Aligned HELP

Post by Ugras »

Dear All,
I use Bullet physics with Ogre for rendering. I export my scene from 3DS MAX with meter unit. And I know the correspondance between Ogre world unit and meter unit. Even I use no unit while exporting the problem is the same. Now,
1) When I create the collision shapes, the render mesh origin and collision shape origin do no match, additionally their orientation is also different.

2) The first solution I can do is to use btCompoundShape and compansate for the origin offset and orientations. But this won't be the optimal solution for my case. I have a graph of nodes representing the mesh entities. Depending on the models I use, the node hierarchy is rather long.

3) I recursively modify the node hierachy and create the collision shapes of the 3d model part in each node, but the origin offset mentioned in (2) is different for each child node.

4) So what is the main problem you see with the situation? Why is there any mismatch?
Thanks for your helps...
Ugras
Ugras
Posts: 34
Joined: Wed Dec 30, 2009 8:30 pm

Re: Collision and Render Shapes Not Aligned HELP

Post by Ugras »

Any idea?
Regards,
Ugras
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Collision and Render Shapes Not Aligned HELP

Post by Erwin Coumans »

What kind of exporter (and fileformat) are you using?

Is there an option to export all triangle meshes in world space (recursively applying/baking the hierarchical transforms)? Otherwise you might want to do this manually when loading the file.

Thanks,
Erwin
Ugras
Posts: 34
Joined: Wed Dec 30, 2009 8:30 pm

Re: Collision and Render Shapes Not Aligned HELP

Post by Ugras »

Dear Erwin Coumans,
At the moment, I am using 3DS files and use ogreMax to export the composed scene to native ogre format. What I noticed in the generated scene file is that:
1) Each child node position/orientation and scale are relative to its parent, not absolute. For example, let's say: there are two mesh model, one parent and one its sub node. The sub node position is (0, 0, 0), orientation (0, 0, 0, 1) ==> quaternion and scale is (1,1,1). But when I render they are positioned correctly which is the child node is tranlated on the +z axis a bit and oriented appropriately. I am confused at this point. If the subnode values are relative then the child should seem at the same position with its parent, but it is not the case.

2) When I simply draw bounding box for its child and parent, one of the bounding boxes is inside the other, which seems logical according to the export scene file.

3) How can I apply the hierarchical transforms in this case?

Regards,
Ugras