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();


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to