Collision problems with btTriangleMesh
Posted: Fri Dec 04, 2015 10:40 pm
Hello,
I am having problems with using triangles meshes as collision objects. In the triangles division my vehicle bump into the lines as if there was a bump there:
https://vimeo.com/147900906
My code:
with
Any suggestions? i already tried increasing the step size and frequency to no avail.
I am having problems with using triangles meshes as collision objects. In the triangles division my vehicle bump into the lines as if there was a bump there:
https://vimeo.com/147900906
My code:
Code: Select all
btTriangleMesh* trimesh = new btTriangleMesh();
//Get the object collision shape from the objVertices variable
staticObjectsVector[mainBodyIdx].convertVerticesToCollisionShape(trimesh);
bool useQuantizedBvhTree = true;
collisionShape = new btBvhTriangleMeshShape(trimesh, useQuantizedBvhTree);
Code: Select all
void openglObject::convertVerticesToCollisionShape(btTriangleMesh* trimesh)
{
for (unsigned int i=0;i<nVertices;i+=3)
trimesh->addTriangle(
btVector3(objVertices[i].x - objectCenter.X, objVertices[i].y - objectCenter.Y, objVertices[i].z - objectCenter.Z),
btVector3(objVertices[i+1].x - objectCenter.X, objVertices[i+1].y - objectCenter.Y, objVertices[i+1].z - objectCenter.Z),
btVector3(objVertices[i+2].x - objectCenter.X, objVertices[i+2].y - objectCenter.Y, objVertices[i+2].z - objectCenter.Z));
}