FriedChicken
21-05-2008 02:46:28
I want to create a body with mutiple shape, so I use addShape() method. But it seems to have only the first shape in collide model.
But when I use CompoundShape instead, I get my desired result.
Body* tank = mScene->createBody("player", new Convex(Resources::ResourceSystem::getSingleton()->getMesh("tankBB1"),sp), Vector3(360, 50, 360), "model: tank.mesh", "mass: 3000");
tank->addShape(new Convex(Resources::ResourceSystem::getSingleton()->getMesh("tankBB2")));
tank->addShape(new Convex(Resources::ResourceSystem::getSingleton()->getMesh("tankBB3")));
tank->addShape(new Convex(Resources::ResourceSystem::getSingleton()->getMesh("tankBB4")));
But when I use CompoundShape instead, I get my desired result.
CompoundShape* shape = new CompoundShape();
shape->add(new Convex(Resources::ResourceSystem::getSingleton()->getMesh("tankBB1"),sp));
shape->add(new Convex(Resources::ResourceSystem::getSingleton()->getMesh("tankBB2"),sp));
shape->add(new Convex(Resources::ResourceSystem::getSingleton()->getMesh("tankBB3"),sp));
shape->add(new Convex(Resources::ResourceSystem::getSingleton()->getMesh("tankBB4"),sp));
Body* tank = mScene->createBody("player", shape, Vector3(360, 50, 360), "model: tank.mesh", "mass: 3000");