add gravity

This commit is contained in:
gugus 2011-03-09 18:23:13 +01:00
parent 122e526cba
commit 79fba7e77e

View file

@ -34,11 +34,11 @@ namespace Physic
externalGhostObject = new PairCachingGhostObject(name); externalGhostObject = new PairCachingGhostObject(name);
externalGhostObject->setWorldTransform( transform ); externalGhostObject->setWorldTransform( transform );
btScalar externalCapsuleHeight = 50; btScalar externalCapsuleHeight = 90;
btScalar externalCapsuleWidth = 20; btScalar externalCapsuleWidth = 16;
externalCollisionShape = new btCapsuleShapeZ( externalCapsuleWidth, externalCapsuleHeight ); externalCollisionShape = new btCapsuleShapeZ( externalCapsuleWidth, externalCapsuleHeight );
externalCollisionShape->setMargin( 1 ); externalCollisionShape->setMargin( 0.05 );
externalGhostObject->setCollisionShape( externalCollisionShape ); externalGhostObject->setCollisionShape( externalCollisionShape );
externalGhostObject->setCollisionFlags( btCollisionObject::CF_CHARACTER_OBJECT ); externalGhostObject->setCollisionFlags( btCollisionObject::CF_CHARACTER_OBJECT );
@ -47,16 +47,16 @@ namespace Physic
internalGhostObject = new PairCachingGhostObject(name); internalGhostObject = new PairCachingGhostObject(name);
internalGhostObject->setWorldTransform( transform ); internalGhostObject->setWorldTransform( transform );
//internalGhostObject->getBroadphaseHandle()->s //internalGhostObject->getBroadphaseHandle()->s
btScalar internalCapsuleHeight = 20; btScalar internalCapsuleHeight = 88;
btScalar internalCapsuleWidth = 5; btScalar internalCapsuleWidth = 15;
internalCollisionShape = new btCapsuleShapeZ( internalCapsuleWidth, internalCapsuleHeight ); internalCollisionShape = new btCapsuleShapeZ( internalCapsuleWidth, internalCapsuleHeight );
internalCollisionShape->setMargin( 1 ); internalCollisionShape->setMargin( 0.05 );
internalGhostObject->setCollisionShape( internalCollisionShape ); internalGhostObject->setCollisionShape( internalCollisionShape );
internalGhostObject->setCollisionFlags( btCollisionObject::CF_CHARACTER_OBJECT ); internalGhostObject->setCollisionFlags( btCollisionObject::CF_CHARACTER_OBJECT );
mCharacter = new btKinematicCharacterController( externalGhostObject,internalGhostObject,btScalar( 0.4 ),1,0 ); mCharacter = new btKinematicCharacterController( externalGhostObject,internalGhostObject,btScalar( 10 ),1,20,20,9.8,0.2 );
mCharacter->setUpAxis(btKinematicCharacterController::Z_AXIS); mCharacter->setUpAxis(btKinematicCharacterController::Z_AXIS);
} }