btCompoundShape* cShape = new btCompoundShape();
for(u32 i = 0;i < meshBufferCount;++i)
{
IMeshBuffer* mb = mesh->getMeshBuffer(i);
cShape->addChildShape(btTransform::getIdentity(),
new btConvexHullShape(&((S3DVertex*)mb->getVertices())->Pos.X,
mb->getVertexCount(), getVertexPitchFromType(mb->getVertexType())));
}
This short snippet will turn any Irrlicht IMesh (Referred to as "mesh" here) into a Bullet Multiple Convex Hull shape (cShape). Works with any vertex type too.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
dlangdev wrote:Would be nice to know how to bind the TerrainSceneNode, tho. I can't seem to get it working using a 512x512 bitmap.
Well, I guess that won't work since blindside creates a convex hull and a terrain definitely has a concave shape. I currently also have this problem with my Userdefined Newton bodies.
That's what come out if you try to make a convexhull of a hut in Newton. (Collision is represented by lines)
Last edited by Masterhawk on Mon Nov 10, 2008 11:57 am, edited 1 time in total.