[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54738] trunk/blender/source/gameengine/ Ketsji/KX_ObjectActuator.cpp: BGE: Fix for bug #34349 " Character walkDirection ADD mode -#INF error" reported by Angus Hollands ( agoose77).
Mitchell Stokes
mogurijin at gmail.com
Fri Feb 22 03:31:47 CET 2013
Revision: 54738
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54738
Author: moguri
Date: 2013-02-22 02:31:46 +0000 (Fri, 22 Feb 2013)
Log Message:
-----------
BGE: Fix for bug #34349 "Character walkDirection ADD mode -#INF error" reported by Angus Hollands (agoose77). If the walk directions canceled each other out, the actuator would try to normalize a zero vector, which caused the error.
Modified Paths:
--------------
trunk/blender/source/gameengine/Ketsji/KX_ObjectActuator.cpp
Modified: trunk/blender/source/gameengine/Ketsji/KX_ObjectActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_ObjectActuator.cpp 2013-02-22 02:10:41 UTC (rev 54737)
+++ trunk/blender/source/gameengine/Ketsji/KX_ObjectActuator.cpp 2013-02-22 02:31:46 UTC (rev 54738)
@@ -221,10 +221,14 @@
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
More information about the Bf-blender-cvs
mailing list