The chunk sizes are 32x32x32 at the moment (but this can be easily modified).
I just took a look into btConvexHull and from the descriptions I found it should do what I want.
Edit: I tried to convert the mesh into a list of points and add them to the btConvexHull. This process, however, is extremely slow.
I tried 2 methods:
A) Iterate through my list of vertices and add them as points to the btConvexHull one by one:
Code: Select all
mCollisionShape = new OgreBulletCollisions::ConvexHullCollisionShape();
for( int i = 0; i < mVertices->size() ; i++)
{
dynamic_cast<OgreBulletCollisions::ConvexHullCollisionShape* >(mCollisionShape)->addPoint(vertexArray[i]);
}
This takes ~10,000 - ~50,000 ms
B) Instead of storing an array of Vector3 vertices, I instead store an array of Scalars, adding 3 scalars per point. I pass this array to the constructor directly.
Code: Select all
mCollisionShape = new OgreBulletCollisions::ConvexHullCollisionShape(pointsArray,
mPoints->size(),
sizeof(btVector3));
This is a bit faster but still above 5,000 ms on average.
Note: I am using OgreBullet's ConvexHullCollisionShape which is simply a very thin wrapper over btConvexShape, here's the constructor:
Code: Select all
ConvexHullCollisionShape::ConvexHullCollisionShape(const Real* points, int numPoints, int stride)
: CollisionShape() {
mShape = new btConvexHullShape((btScalar*) points, numPoints, stride);
}
I'm assuming this isn't a problem with OgreBullet.