Quantcast
Viewing all articles
Browse latest Browse all 6821

How to retrieve the position of a ModelMesh whose position was set in blender?

@Optmisitic_Peach wrote:

Hi there, I have a tree that I have created in blender:


Where each one of the "Bushes" of sorts is it's own ModelMesh. I load this into my game and render it using this to apply the positions and scales:
        Matrix[] modelTransforms = new Matrix[TreeModel.Bones.Count];
        TreeModel.CopyAbsoluteBoneTransformsTo(modelTransforms);

        foreach (var Mesh in TreeModel.Meshes)
        {
            foreach (BasicEffect effect in Mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.AmbientLightColor = new Vector3(0.35f);

                effect.View = Cam.viewMatrix;
                effect.Projection = RotatingCam.projectionMatrix;

                effect.World = modelTransforms[Mesh.ParentBone.Index];
            }
            Mesh.Draw();
        }

It renders just fine, and now I am using a separate render target and color IDs to get which "Bush" the mouse is over.
What I need is a way to get the Position of the bush in Coordinates so that I can move my camera over it when it's clicked.
All help is greatly appreciated!

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles