thank you for reply
I use ogreBullet.
(2) What shape types are being used for the tree and character?
So for my character i use a collisionBox
Code: Select all
AxisAlignedBox boundingB = mPJ->mEntityCorps->getBoundingBox();
Vector3 size = boundingB.getSize(); //size /= 2.0f; // only the half needed
//size *= 0.96f; // Bullet margin is a bit bigger so we need a smaller size
// (Bullet 2.76 Physics SDK Manual page 18)
// after that create the Bullet shape with the calculated size
OgreBulletCollisions::BoxCollisionShape *sceneBoxShape = new OgreBulletCollisions::BoxCollisionShape(size);
defaultBody = new OgreBulletDynamics::RigidBody("defaultBoxRigid2",mWorld);
defaultBody->setShape(mPJ->mNode,
sceneBoxShape,
0.6f, // dynamic body restitution
0.6f, // dynamic body friction
70.0f, // dynamic bodymass
Ogre::Vector3(mPJ->mNode->getPosition().x, mPJ->mNode->getPosition().y, mPJ->mNode->getPosition().z), // starting position of the box
mPJ->mNode ->getOrientation()) ;// orientation of the box
defaultBody->enableActiveState();
mWorld->addRigidBody(defaultBody, 0, 0);
For the tree I use a triangleMeshShape
Code: Select all
// collisionShape
AxisAlignedBox boundingB = mSceneMgr->getEntity("Arbre0")->getBoundingBox();
Vector3 size = mSceneMgr->getEntity("Arbre0")->getBoundingBox().getSize(); //size /= 2.0f; // only the half needed
//size *= 0.96f; // Bullet margin is a bit bigger so we need a smaller size
// (Bullet 2.76 Physics SDK Manual page 18)
SceneNode *node = mSceneMgr->getEntity("Arbre0")->getParentSceneNode();
OgreBulletCollisions::StaticMeshToShapeConverter *smtsc = new OgreBulletCollisions::StaticMeshToShapeConverter();
smtsc->addEntity(mSceneMgr->getEntity("Arbre0"));
OgreBulletCollisions::TriangleMeshCollisionShape *collisionShape = smtsc->createTrimesh();
//RigidBody
OgreBulletDynamics::RigidBody *defaultBody = new OgreBulletDynamics::RigidBody("defaultBoxRigid",mWorld);
defaultBody->setShape(node,
collisionShape,
0.6f, // dynamic body restitution
0.6f, // dynamic body friction
0.0f, // dynamic bodymass
Ogre::Vector3(node->getPosition()), // starting position of the box
Quaternion(180, 0, 0, 1));// orientation of the box
defaultBody->enableActiveState();
mWorld->addRigidBody(defaultBody,0,0);
(1) How does the character move? Are you using btKinematicCharacterController or something else?
I use Ogre to move my character ? I did'nt know btKinematicCharacterController.