From 29e968a3158b2e51a7d03b993b5e64a47ebea276 Mon Sep 17 00:00:00 2001 From: Thomas Szepe Date: Sun, 5 Apr 2015 10:13:04 +0200 Subject: BGE: Fix T36703: Character motion actuator local movement not working correct. The character motion actuator local movement does not taking account of the object rotation. It is necessary to rotate the motion vector before adding the local movement. Reviewers: sybren, lordloki, moguri Reviewed By: lordloki, moguri Maniphest Tasks: T42709 Differential Revision: https://developer.blender.org/D1206 --- source/gameengine/Ketsji/KX_ObjectActuator.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source/gameengine/Ketsji/KX_ObjectActuator.cpp') diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index 0eec86987be..f65b0ac0f4f 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -223,6 +223,11 @@ bool KX_ObjectActuator::Update() else if (m_bitLocalFlag.CharacterMotion) { MT_Vector3 dir = m_dloc; + if (m_bitLocalFlag.DLoc) { + MT_Matrix3x3 basis = parent->GetPhysicsController()->GetOrientation(); + dir = basis * dir; + } + if (m_bitLocalFlag.AddOrSetCharLoc) { MT_Vector3 old_dir = character->GetWalkDirection(); @@ -236,11 +241,6 @@ bool KX_ObjectActuator::Update() } // We always want to set the walk direction since a walk direction of (0, 0, 0) should stop the character - if (m_bitLocalFlag.DLoc) - { - MT_Matrix3x3 basis = parent->GetPhysicsController()->GetOrientation(); - dir = basis*dir; - } character->SetWalkDirection(dir/parent->GetScene()->GetPhysicsEnvironment()->GetNumTimeSubSteps()); if (!m_bitLocalFlag.ZeroDRot) -- cgit v1.2.3