Staticmesh level not drawn
Posted: Fri May 13, 2011 8:37 pm
Following basicsetupdemo, i'm using :
//Create a physical environment from a triangle mesh.
//First, collect the the mesh data from the model using a helper function.
//This special kind of vertex inherits from the TriangleMeshVertex and optionally includes
//friction/bounciness data.
//The StaticTriangleGroup requires that this special vertex type is used in lieu of a normal TriangleMeshVertex array.
Vector3[] vertices;
int[] indices;
TriangleMesh.GetVerticesAndIndicesFromModel(FireLevelModel, out vertices, out indices);
//Give the mesh information to a new StaticMesh.
//Give it a transformation which scoots it down below the kinematic box entity we created earlier.
var mesh = new StaticMesh(vertices, indices, new AffineTransform(new Vector3(0, -10, 0)));
mesh.Tag = "level";
//Add it to the space!
myGame.Space.Add(mesh);
//Make it visible too.
myGame.Components.Add(new StaticModel(FireLevelModel, mesh.WorldTransform.Matrix, myGame));
The mesh doesn't appear. However, it is there (because my character lands on it with gravity). Why is this happening? It used to work but now i'm trying to integrate it with a menu class then this problem appears.
//Create a physical environment from a triangle mesh.
//First, collect the the mesh data from the model using a helper function.
//This special kind of vertex inherits from the TriangleMeshVertex and optionally includes
//friction/bounciness data.
//The StaticTriangleGroup requires that this special vertex type is used in lieu of a normal TriangleMeshVertex array.
Vector3[] vertices;
int[] indices;
TriangleMesh.GetVerticesAndIndicesFromModel(FireLevelModel, out vertices, out indices);
//Give the mesh information to a new StaticMesh.
//Give it a transformation which scoots it down below the kinematic box entity we created earlier.
var mesh = new StaticMesh(vertices, indices, new AffineTransform(new Vector3(0, -10, 0)));
mesh.Tag = "level";
//Add it to the space!
myGame.Space.Add(mesh);
//Make it visible too.
myGame.Components.Add(new StaticModel(FireLevelModel, mesh.WorldTransform.Matrix, myGame));
The mesh doesn't appear. However, it is there (because my character lands on it with gravity). Why is this happening? It used to work but now i'm trying to integrate it with a menu class then this problem appears.