   How to convert a graphic Mesh object into a PhysX Actor?
  I am using nVidia PhysX as my games Physics engine. I have stumbled upon a problem where I need to convert a 3d (graphic) Mesh (loaded from a '.x' file) into a PhysX actor. Can anybody guide me on what I should do?   
  PhysX includes a "cooking" library to convert arbitrary meshes into a suitable format as an offline process. Look up NxCooking (or something like that) in the PhysX SDK for more info.   ;  Is this going to be static or dynamic? if its static then you'll probably want a NxTriangleMesh but if its dynamic you can't use that sot he best you can get is NxConvexMesh. The basic idea is to load the mesh as normal, fill out a description (NxTriangleMeshDesc/NxConvexMeshDesc) as appropriate and then "bake" it into a NxTriangleMexh/NxConvexMesh using the cooking library.Once you have a triangle/convex mesh you can make an actor with it same way as you can aany other primitive shape.NxTriangleMesh triangleMesh;NxTriangleMeshShapeDesc triangleShapeDesc;triangleShapeDesc.meshData = &triangleMesh;NxActorDesc ActorDesc;ActorDesc.shapes.pushBack(&triangleShapeDesc);I beleive there is an example of this on the sdk. Unfortunatly my own code is too spread out to post anything helpful but heres some terms that may come in handy:NxGetCookingLibNxCookTriangleMeshNxCookConvexMeshNxConvexMeshDescNxConvexMeshNxTriangleMeshDescNxTriangleMesh   ;  Yeah i managed it it takes a long time to get it working, most of the code i found on the net didn't work.After hacking around with bits of code i got it.I'd suggest having a go at doing it yourself and if you really get stuck i'll post some code or you can contact me via the support page in my website (link below, doing this to avoid spam). It's just i don't have access to my dev computer atmo.Basically, load your model as normal into memory.Pass, verts from model into the function, i think it's PhysCreatemesh or something.You then cook the mesh and save the file and then load it either from file or directly from baked data.Have a look at the SDK and the example in there and then google it a bit.Nanoha basically has it, but don't forget either do a convexmesh or triangle mesh, don't take functions of both.Hope that helps.PureBlackSin   ;  Check\<PhysX SDK Root Dir>\TrainingPrograms\Docs\Chap1\Lesson102.doc (Mesh shapes)and the samples folder \<PhysX SDK Root Dir>\Sampleshas example code for almost everything   ;Quote:Original post by NanohaIs this going to be static or dynamic? if its static then you'll probably want a NxTriangleMesh but if its dynamic you can't use that sot he best you can get is NxConvexMesh. The basic idea is to load the mesh as normal, fill out a description (NxTriangleMeshDesc/NxConvexMeshDesc) as appropriate and then "bake" it into a NxTriangleMexh/NxConvexMesh using the cooking library.Once you have a triangle/convex mesh you can make an actor with it same way as you can aany other primitive shape.NxTriangleMesh triangleMesh;NxTriangleMeshShapeDesc triangleShapeDesc;triangleShapeDesc.meshData = &triangleMesh;NxActorDesc ActorDesc;ActorDesc.shapes.pushBack(&triangleShapeDesc);I beleive there is an example of this on the sdk. Unfortunatly my own code is too spread out to post anything helpful but heres some terms that may come in handy:NxGetCookingLibNxCookTriangleMeshNxCookConvexMeshNxConvexMeshDescNxConvexMeshNxTriangleMeshDescNxTriangleMeshWell, right now i just need to make the mesh object as static. But still, I do want to know how I could do it if the object was not static. I spent about 7 to 8 hours figuring how to create a NxConvexMesh object but without any success! :(In your above code, can you tell me, how could I get triangleShapeDesc from the .x file of the mesh (which is actually exported from Maya).   ;Quote:Original post by NumberXaeroCheck\<PhysX SDK Root Dir>\TrainingPrograms\Docs\Chap1\Lesson102.doc (Mesh shapes)and the samples folder \<PhysX SDK Root Dir>\Sampleshas example code for almost everythingThanks... I will look into this document and see if I could work it out...   