Collision Mesh and Model Mesh A Bit Off
Posted: Sat Mar 24, 2012 3:56 am
Hello,
I'm trying to just make use of the mesh collision features of the engine, but I seem to be having problems getting the collider to match up with the model. I'm making a space game and I just need meshes for the giant, static ships.
I basically only need to do Mesh to Sphere collisions. When my Spheres collide with the Mesh, they seem to do so at strange locations. They're close, but it's not when my ship or bullet pierces a face like I'd want.
Am I positioning them wrong? Or is meshCollider.CollisionInformation.Events.InitialCollisionDetected the wrong time to be calling my onCollide?
I'm trying to just make use of the mesh collision features of the engine, but I seem to be having problems getting the collider to match up with the model. I'm making a space game and I just need meshes for the giant, static ships.
Code: Select all
private ConvexHull meshCollider;
public CollisionMesh(Model _model, Vector3 _position, Quaternion _rotation)
{
position = _position;
Vector3[] vertices;
int[] indices;
TriangleMesh.GetVerticesAndIndicesFromModel(_model, out vertices, out indices);
meshCollider = new ConvexHull(vertices);
meshCollider.Position = _position;
meshCollider.Orientation = _rotation;
meshCollider.BecomeDynamic(1);
}
Am I positioning them wrong? Or is meshCollider.CollisionInformation.Events.InitialCollisionDetected the wrong time to be calling my onCollide?