I would like my class to inherit btRigidBody, but without all the constructor variables.
For example, I just want to be able to call
Code: Select all
terrain = new Terrain();
For example, something like this:
Code: Select all
Terrain::Terrain(Game* p_Game) {
[color=#FF0000]/*Terrain specific variable setting etc*/[/color]
/*Bullet specific things*/
BtOgre::StaticMeshToShapeConverter converter(m_Entity);
btCollisionShape* colShape = converter.createTrimesh();
btScalar mass(0);
btVector3 inertia;
BtOgre::RigidBodyState *state = new BtOgre::RigidBodyState( m_3DNode );
this = new btRigidBody(mass, state, colShape, inertia);
p_Game->m_PhysicsWorld->addRigidBody(this);
}
Incase I can get some better suggestions to the specific problem, what I want to be able to do is cast a ray and return RayCallback.m_CollisionObject which I can then cast as an (Actor*) object to interact with, using a stored enum to decide whether to then cast it to a terrain, building, vehicle, etc.
After all, if I put my CollisionObject* as a variable inside Terrain, the ray will tell me which CollisionObject was hit, but not which terrain, player, ship, vehicle, etc that pointer belongs to.
Is there a better way of achieving this than inheriting the collision object?