[Bf-blender-cvs] [11bbe69] blender-v2.72-release: Fix Python ray-cast failing to check hit direction

Campbell Barton noreply at git.blender.org
Wed Oct 15 13:08:15 CEST 2014


Commit: 11bbe69b2af06b388e18999076245454cd1192fd
Author: Campbell Barton
Date:   Wed Oct 8 09:42:34 2014 +0200
Branches: blender-v2.72-release
https://developer.blender.org/rB11bbe69b2af06b388e18999076245454cd1192fd

Fix Python ray-cast failing to check hit direction

===================================================================

M	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 b4add0f..0f0ffe9 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);




More information about the Bf-blender-cvs mailing list