diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-08-27 10:55:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-08-27 10:55:54 +0400 |
commit | 324b3fbe747a6544b60be1eb8a0cb6b01db736de (patch) | |
tree | c2a66d777b5a8ca815629a00c82ee68a8c15e3e8 /source/gameengine/Ketsji | |
parent | 0db2975ff6cc2592b062f749059e640dc1e2b140 (diff) |
- BGE crash fix when casting a ray to the same location as the object from python.
- Incorrect Mathutils vector docstrings.
- last rayshade commit had an incomplete comment.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index d04174a32aa..ba8905973d5 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -2597,12 +2597,10 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo, } } MT_Point3 fromPoint = NodeGetWorldPosition(); + if (dist != 0.0f) - { - MT_Vector3 toDir = toPoint-fromPoint; - toDir.normalize(); - toPoint = fromPoint + (dist) * toDir; - } + toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized(); + PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment(); KX_IPhysicsController *spc = GetPhysicsController(); KX_GameObject *parent = GetParent(); |