From 394284d0f839bf4c135e842534161c8505112c97 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 22 Mar 2014 00:46:47 +0100 Subject: [PATCH] Fixes #1209: Tarhiel never falls There are a few pitfalls with this code: - Gravity is only considered when applying queued movement. Therefore, make sure to queue some movement every frame. (Could be refactored in the future?) - The character controller never detects being in free fall (!World::isOnGround) unless movement has been applied. --- apps/openmw/mwmechanics/character.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 04d909b49..2db3bacf0 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1245,12 +1245,8 @@ void CharacterController::update(float duration) else //avoid z-rotating for knockdown world->rotateObject(mPtr, rot.x, rot.y, 0.0f, true); - // always control actual movement by animation unless this: - // FIXME: actor falling/landing should be controlled by physics engine - if(mMovementAnimVelocity == 0.0f && (vec.length() > 0.0f || mJumpState != JumpState_None)) - { + if (mMovementAnimVelocity == 0) world->queueMovement(mPtr, vec); - } } movement = vec; @@ -1290,7 +1286,7 @@ void CharacterController::update(float duration) } // Update movement - if(moved.squaredLength() > 1.0f) + if(mMovementAnimVelocity > 0) world->queueMovement(mPtr, moved); } mSkipAnim = false;