Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index 9355ad0adfd..b4ee339568c 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -221,10 +221,14 @@ bool KX_ObjectActuator::Update()
if (m_bitLocalFlag.AddOrSetCharLoc) {
MT_Vector3 old_dir = parent->GetPhysicsController()->GetWalkDirection();
- MT_Scalar mag = old_dir.length();
- if (mag < MT_EPSILON)
- mag = dir.length();
- dir = (dir + old_dir).normalized() * mag;
+
+ if (!old_dir.fuzzyZero()) {
+ MT_Scalar mag = old_dir.length();
+
+ dir = dir + old_dir;
+ if (!dir.fuzzyZero())
+ dir = dir.normalized() * mag;
+ }
}
// We always want to set the walk direction since a walk direction of (0, 0, 0) should stop the character