[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15504] trunk/blender/source/gameengine/ Ketsji/KX_GameObject.cpp: bugfix, vector was not checked for zero length before normalizing, closing blender instantly with an assert.
Campbell Barton
ideasman42 at gmail.com
Wed Jul 9 17:30:15 CEST 2008
Revision: 15504
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15504
Author: campbellbarton
Date: 2008-07-09 17:30:15 +0200 (Wed, 09 Jul 2008)
Log Message:
-----------
bugfix, vector was not checked for zero length before normalizing, closing blender instantly with an assert.
Modified Paths:
--------------
trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp 2008-07-09 15:25:34 UTC (rev 15503)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp 2008-07-09 15:30:15 UTC (rev 15504)
@@ -1608,14 +1608,18 @@
other = static_cast<KX_GameObject*>(pyfrom);
fromPoint = other->NodeGetWorldPosition();
}
-
- if (dist != 0.0f)
- {
+
+ if (dist != 0.0f) {
MT_Vector3 toDir = toPoint-fromPoint;
+ if (MT_fuzzyZero(toDir.length2())) {
+ return Py_BuildValue("OOO", Py_None, Py_None, Py_None);
+ }
toDir.normalize();
toPoint = fromPoint + (dist) * toDir;
+ } else if (MT_fuzzyZero((toPoint-fromPoint).length2())) {
+ return Py_BuildValue("OOO", Py_None, Py_None, Py_None);
}
-
+
MT_Point3 resultPoint;
MT_Vector3 resultNormal;
PHY_IPhysicsEnvironment* pe = GetPhysicsEnvironment();
More information about the Bf-blender-cvs
mailing list