I'm loading a multiple mesh object via code and want access to the individual mesh names so I can check which mesh is colliding with my table object. When loading I only have the option to name the object as a whole and cannot name the individual meshes contained in the object through code. I have a six sided die with each face as its own mesh. I set the CollisionType = Collide and use the ApplyForce() to simulate a dice roll. The die collides with the table correctly but I would like to use the mesh names to detect which side of the die is colliding with the table so I can use the face that is opposite to the side that is colliding with the table to get the result of the die value that is facing up. If there are any other suggestions on how to find which die side is facing up after its been rolled using the SunBurn physics system would be helpful.
Thanks!
Hi Moe,
You can access the object's meshes using the SceneObject.RenderableMeshes property. Each mesh contains a Name property, which is initially set to the mesh's name in your modeling app, but can be changed as needed.
However in this case I think it would be easier to use the object World transform and its Forward, Up, Left properties to determine how the object is oriented.
Let me know if this helps!
Follow me on Twitter – development and personal tweetsAwesome XNA Videos – Lighting, Rendering, and game videos
I got it to work. Thanks.