Kinematic Character Controller Bouncing Up and Down

Post Reply
BlueSpud
Posts: 2
Joined: Wed Aug 06, 2014 6:44 pm

Kinematic Character Controller Bouncing Up and Down

Post by BlueSpud »

Hey,
I've had this problem for a while, but I've just now decided to ask about it. I have a btKinematicCharacterController to control my player in my game engine. I'm using a capsule shape, but I also tried a cylinder and the same thing happens. When I'm walking on flat polygons (triangles) the character controller randomly bounces up and down. These are rather large triangles because they are the floor. Heres my code for creating the character controller:

Code: Select all


 btPairCachingGhostObject* ghostBody;
            btKinematicCharacterController* characterController;

//create the shape and the properties for the player
        btTransform t;
        t.setIdentity();
        t.setOrigin(btVector3(0,3,0));
        
        btConvexShape* capsule = new btCapsuleShape(PLAYER_CAPSULE_RADIUS,PLAYER_CAPSULE_HEIGHT);
        //btConvexShape* capsule = new btCylinderShape(btVector3(PLAYER_CAPSULE_RADIUS,PLAYER_CAPSULE_HEIGHT/2,PLAYER_CAPSULE_RADIUS));
        
        ghostBody = new btPairCachingGhostObject();
        ghostBody->setWorldTransform(t);
        ghostBody->setCollisionShape(capsule);
        
        ghostBody->setCollisionFlags (btCollisionObject::CF_CHARACTER_OBJECT);
     
        //alocate the character object
        characterController = new btKinematicCharacterController(ghostBody,capsule,btScalar(PLAYER_STEP_SIZE));
        characterController->setUseGhostSweepTest(false);
        
        world->addCollisionObject(ghostBody, btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter);
        world->addAction(characterController);




Any help or advice would be appreciated, thanks!
Post Reply