BEPUphysics.DataStructures.TriangleMesh.GetVerticesAndIndicesFromModel C# (CSharp) Method

GetVerticesAndIndicesFromModel() public static method

Gets an array of vertices and indices from the provided model.
public static GetVerticesAndIndicesFromModel ( Model collisionModel, Microsoft.Xna.Framework.Vector3 &vertices, int &indices ) : void
collisionModel Microsoft.Xna.Framework.Graphics.Model Model to use for the collision shape.
vertices Microsoft.Xna.Framework.Vector3 Compiled set of vertices from the model.
indices int Compiled set of indices from the model.
return void
        public static void GetVerticesAndIndicesFromModel(Model collisionModel, out Vector3[] vertices, out int[] indices)
        {
            var verticesList = new List<Vector3>();
            var indicesList = new List<int>();
            var transforms = new Matrix[collisionModel.Bones.Count];
            collisionModel.CopyAbsoluteBoneTransformsTo(transforms);

            Matrix transform;
            foreach (ModelMesh mesh in collisionModel.Meshes)
            {
                if (mesh.ParentBone != null)
                    transform = transforms[mesh.ParentBone.Index];
                else
                    transform = Matrix.Identity;
                AddMesh(mesh, transform, verticesList, indicesList);
            }

            vertices = verticesList.ToArray();
            indices = indicesList.ToArray();


        }