Search code examples
3dsmaxcoordinate

Pass a specific point on a model to the engine


I am sorry if what I ask is a trivial question, but I have no idea how to even begin searching for the answer in a search engine.

I clearly understand how to create a model in 3ds max and load it into an XNA (for instance) program, what I need is to be able to pick a point on a model in the 3ds MAX app and then to be able to trace it's world space position in my XNA app at any given point it time.

Why? I need it to trace where the player gun's muzzle is to create a muzzleflash effect in the right spot when the player fires.

I would appreciate any help, thanks.


Solution

  • Well in XNA the problem is solved quite easily by copying the bone transforms of the point. One just needs to set the point as a ModelMesh in the 3d creation tool. E. g. in 3ds MAX it is by setting it as a separate element of the scene. Then in the engine you can access the ModelMesh by its .Name propery and get it's position by doing Model.CopyAbsoluteBoneTransformsTo(). There are a few more steps to do, but if you search CopyAbsoluteBoneTransformsTo you will find all you need.

    Here is the Stack Overfrol article that helped me:

    Position of a modelmesh in XNA