Problems with RigidModelBodyProcessor

Apr 13, 2010 at 9:25 PM
Edited Apr 13, 2010 at 9:27 PM

1) I'm using CullMode CCW in my project.  I tried to flip holodeck to render with CullMode=CCW and changed the model importers to not flip the winding direction.  Everything renders fine but the collison skins are messed up.  When the RigidModelBodyProcessor generates a MeshPart (in the case for shape==PhysicalShape.Mesh)... it assumes CW windings.  I'm trying to change it to generate the correct skin for a CCW system.  I thought that I could just change the index order that it built the triangle list for in the CompiledMesh constructor but couldn't get this to work.  Any ideas of an easy change to make CCW work?  Ideally this would be selectable as a parameter (Swap Collision Winding Order).  It needs to be a sepperate setting from the existing Swap Winding Order because it doesn't know if you are rendering with CCW or CW.

//_triangles[j] = new int[] { indices[i], indices[i + 1], indices[i + 2] };
//Vector3 v12, v13;
//Vector3.Subtract(ref _body[indices[i + 1]], ref _body[indices[i]], out v12);
//Vector3.Subtract(ref _body[indices[i + 2]], ref _body[indices[i]], out v13);

_triangles[j] = new int[] { indices[i+2], indices[i + 1], indices[i] };
Vector3 v12, v13;
Vector3.Subtract(ref _body[indices[i + 1]], ref _body[indices[i+2]], out v12);
Vector3.Subtract(ref _body[indices[i]], ref _body[indices[i+2]], out v13);

2) In the case for shape = PhysicalShape.Mesh the meshMass is set to immovable. Would the same code line of code from Polyhedron work?

3) Does it make sense to add a DefaultShape parameter to control this for models that don't have custom attributes added to the fbx file but you still want to pick a lighter weight collision skin than mesh?

Apr 13, 2010 at 10:34 PM

I'll have to play around with #1. I've upgraded to VS2010 and I'm trying to get XNA working adequately under it, but the content pipeline is the most problematic part. I'm really hoping to avoid installing 2008 side by side...

For #2, you should be able to set any object's mass to immovable (essentially, this just gives it infinite mass). Meshes are set to that because I only wanted to support meshes that are frozen in place for now, mainly because mesh-mesh collisions are mostly impractical. Giving any other object type infinite mass should have the same effect. Conversely, assigning movable mass properties to a mesh "might" work but it could give some pretty wild results...

For #3, I could see how that would be useful if you already have an .fbx file and don't want to modify it just to tell the processor what type of shape to use. I'll add that feature to my list.

Apr 13, 2010 at 10:49 PM

I've compiled your projects for VS 2010 w/ GS4 but can't do VS 2010 w/ GS3.1  The word appears to be that VS2010 w/ GS 3.1 doesn't and won't be made to work.  You can install GS 4 w/ 2010 and GS 3.1 w/ 2008 side by side. 

Apr 14, 2010 at 6:07 PM

Anxiously awaiting the release of GS4!

Apr 22, 2010 at 8:08 AM

Instead of waiting for the next GS update, I did go ahead and reinstall VS2008 for now. I fixed the #1 item from above and also added a property for winding order. It will have explicit values for which winding order the processor can expect, after any processing is done by the base class--including the effects of SwapWindingOrder. Holodeck now uses CCW culling for the shapes. Also took your suggestion and added a DefaultShape property.

Apr 23, 2010 at 3:50 PM

Many thanks for fixing this.