diff options
author | Thomas Szepe <HG1_public@gmx.net> | 2015-04-05 11:13:04 +0300 |
---|---|---|
committer | Thomas Szepe <HG1_public@gmx.net> | 2015-04-05 11:13:04 +0300 |
commit | 29e968a3158b2e51a7d03b993b5e64a47ebea276 (patch) | |
tree | 662d8522a76241b73109408d62b078ed795e5cf0 /source/gameengine/Ketsji | |
parent | 1a117ad40c62cfab3cec6c4513627e781cd2b331 (diff) |
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
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_ObjectActuator.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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) |