From a550d913bcd67f26f7a0f59ff0c66f6a65539d69 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 8 Oct 2014 09:42:34 +0200 Subject: Fix Python ray-cast failing to check hit direction --- source/blender/python/mathutils/mathutils_geometry.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/python/mathutils/mathutils_geometry.c') diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index b4add0fc615..0f0ffe9fec5 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -149,6 +149,11 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject * /* calculate t, ray intersects triangle */ t = dot_v3v3(e2, qvec) * inv_det; + /* ray hit behind */ + if (t < 0.0f) { + Py_RETURN_NONE; + } + mul_v3_fl(dir, t); add_v3_v3v3(pvec, orig, dir); -- cgit v1.2.3