I have problems with setting orientation for static mesh - using MoveTo(). For immovable objects.
Setting position doesn't look to be a problem, only orientation.
I want to set the orientation at object creation time (only once). But of course it would be nice if I can change position and orientation later.
This is how I initialize static mesh object:
TriangleMesh triangleMesh = new TriangleMesh();
triangleMesh.CreateMesh(Model.Vertexes, Model.Triangles, 4, 1.0f);
List<MyCollisionPrimitive> collisionPrimitives = new List<MyCollisionPrimitive>();
collisionPrimitives.Add(new MyCollisionPrimitive(triangleMesh, MaterialTable.MaterialID.UserDefined, MyConstants.PHYSICS_MATERIAL_PROPERTIES));
Body.CollisionSkin = new CollisionSkin(Body);
Body.Immovable = true;
Body.ApplyGravity = false;
m_invertedCenterOfMass = -1 * SetMass(mass);
Body.CollisionSkin.ApplyLocalTransform(new Transform(m_invertedCenterOfMass, orientation));
Ok, and now what doesn't work? If I set orientation to Matrix.Identity, objects (e.g. sphere) don't fall through this static mesh. If I set orientation to something like Matrix.CreateRotationY(MathHelper.ToRadians(90)), objects start falling through it.
I am sure it has something to do with collision skin transformation. BTW, in comments to MoveTo method is written:
Be a little careful about when you call it - it will mess with the physics collision list.
Thank for any help.