[SOLVED] PhysX Candy Wrapper - shape descriptions?

CodeKrash

04-03-2011 00:22:26

I went through http://www.ogre3d.org/tikiwiki/PhysX+Ca ... #PhysX_SDK It has lots of exact source code for doing the critical parts, but no examples of implementing the source code that supposedly "bakes" the mesh for use as a "shape description". I have a working physX system going, but I can't seem to get a static ground working and I think it has something to do with the "shape description", but I can't figure out how to use the provided example code. The only clue I have is the comment in the code that indicates the if you set the body of the actor description to null then it will become static, and I did that, but my player still falls straight through my static "ground". Can someone please point me in the right direction?

CodeKrash

04-03-2011 01:52:32

#region physics
// the actor properties control the mass, position and orientation
// if you leave the body set to null it will become a static actor and wont move
ActorDesc actorDesc2 = new ActorDesc();
actorDesc2.Density = 4;
actorDesc2.Body = null;
actorDesc2.GlobalPosition = nodes["ground"].Position;
actorDesc2.GlobalOrientation = nodes["ground"].Orientation.ToRotationMatrix();


PhysXHelpers.StaticMeshData meshdata = new PhysXHelpers.StaticMeshData(entities["GroundEntity"].GetMesh());
actorDesc2.Shapes.Add(PhysXHelpers.CreateTriangleMesh(meshdata));

// finally, create the actor in the physics scene
Actor actor2 = OgreWindow.Instance.scene.CreateActor(actorDesc2);

// create our special actor node to tie together the scene node and actor that we can update its position later
ActorNode actorNode2 = new ActorNode(nodes["ground"], actor2);
actors.Add(actorNode2);
#endregion


that is:
PhysXHelpers.StaticMeshData meshdata = new PhysXHelpers.StaticMeshData(themeshptr);
actorDesc2.Shapes.Add(PhysXHelpers.CreateTriangleMesh(meshdata));