Latin1
15-07-2011 03:42:45
Hi everyone,
I've recently finished the second OgreBullet tutorial, in which boxes fall and collide with the ground, a flat surface. It does this with two objects: a flat entity based on an Ogre::Plane, and a flat OgreBulletDynamics::RigidBody object:
How can I replace the plane with heightmap-based Ogre::Terrain object? Obviously, it's much more complicated than using a flat surface, as I would need to fetch the shape of the Terrain and give it to OgreBullet.
There are already a few posts about this, but most of them are somewhat old and involve the Terrain Scene Manager, which will apparently be deprecated in Ogre 1.8.
I've noticed the OgreBulletCollisionsTerrainShape.h file and the HeightmapCollisionShape class, but I haven't found any practical information on them and I'm not sure how to create a RigidBody (or whatever object type is appropriate) from an Ogre::Terrain object.
There aren't that many threads about using Terrains with OgreBullet (or just Bullet), so I feel like people have gotten this figured out; maybe there's a tutorial or a guide I haven't found yet?
Thank you, I hope someone can point me in the right direction.
I've recently finished the second OgreBullet tutorial, in which boxes fall and collide with the ground, a flat surface. It does this with two objects: a flat entity based on an Ogre::Plane, and a flat OgreBulletDynamics::RigidBody object:
OgreBulletCollisions::CollisionShape *Shape;
Shape = new OgreBulletCollisions::StaticPlaneCollisionShape(Ogre::Vector3(0,1,0), 0); // (normal vector, distance)
OgreBulletDynamics::RigidBody *defaultPlaneBody = new OgreBulletDynamics::RigidBody(
"BasePlane",
mWorld); // OgreBulletDynamics::DynamicsWorld object
defaultPlaneBody->setStaticShape(Shape, 0.1, 0.8); // (shape, restitution, friction)
How can I replace the plane with heightmap-based Ogre::Terrain object? Obviously, it's much more complicated than using a flat surface, as I would need to fetch the shape of the Terrain and give it to OgreBullet.
There are already a few posts about this, but most of them are somewhat old and involve the Terrain Scene Manager, which will apparently be deprecated in Ogre 1.8.
I've noticed the OgreBulletCollisionsTerrainShape.h file and the HeightmapCollisionShape class, but I haven't found any practical information on them and I'm not sure how to create a RigidBody (or whatever object type is appropriate) from an Ogre::Terrain object.
There aren't that many threads about using Terrains with OgreBullet (or just Bullet), so I feel like people have gotten this figured out; maybe there's a tutorial or a guide I haven't found yet?
Thank you, I hope someone can point me in the right direction.