diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-07-10 16:49:55 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-07-10 16:49:55 +0400 |
commit | 06354f7f75750513987d19c9a9b9d760e7f762f9 (patch) | |
tree | 4706d6ec769ed9b75d79d5e3fb6acefeeb06c467 /source/gameengine/Ketsji/KX_GameObject.cpp | |
parent | ad103954e64917673077d61cb6b495e78e7a6be9 (diff) |
Apricot Branch
==============
svn merge -r15501:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/gameengine/Ketsji/KX_GameObject.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 385dc25f6a2..2ac4f909077 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1608,14 +1608,18 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast, 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(); |