[Bf-blender-cvs] [29e968a] master: BGE: Fix T36703: Character motion actuator local movement not working correct.
Thomas Szepe
noreply at git.blender.org
Sun Apr 5 10:14:11 CEST 2015
Commit: 29e968a3158b2e51a7d03b993b5e64a47ebea276
Author: Thomas Szepe
Date: Sun Apr 5 10:13:04 2015 +0200
Branches: master
https://developer.blender.org/rB29e968a3158b2e51a7d03b993b5e64a47ebea276
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
===================================================================
M source/gameengine/Ketsji/KX_ObjectActuator.cpp
===================================================================
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index 0eec869..f65b0ac 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)
More information about the Bf-blender-cvs
mailing list