BGE: Fix to make KX_CharacterWrapper.jumpCount work a bit smoother. Previously jumpCount was only getting reset to 0 if the character was on the ground while jump() was being called. This works alright internally for double jumping, but it made things awkward if a user wanted to check jumpCount before calling jump() (i.e., before jumpCount was updated).

This commit is contained in:
Mitchell Stokes 2013-02-09 06:32:17 +00:00
parent e3488af838
commit 8eabdad3aa

@ -78,6 +78,9 @@ BlenderBulletCharacterController::BlenderBulletCharacterController(btMotionState
void BlenderBulletCharacterController::updateAction(btCollisionWorld *collisionWorld, btScalar dt)
{
if (onGround())
m_jumps = 0;
btKinematicCharacterController::updateAction(collisionWorld,dt);
m_motionState->setWorldTransform(getGhostObject()->getWorldTransform());
}
@ -104,9 +107,6 @@ bool BlenderBulletCharacterController::canJump() const
void BlenderBulletCharacterController::jump()
{
if (onGround())
m_jumps = 0;
if (!canJump())
return;