Object.raycast: error in previous commit
[blender.git] / source / blender / makesrna / intern / rna_object_api.c
index b3bc2c72d34374345a12af0f4c61971a271b49c9..558521390658c1466bf636890874a6a6b10f027d 100644 (file)
@@ -335,9 +335,11 @@ static void rna_Object_ray_cast(
                if (isect_ray_aabb_v3_simple(origin, direction, bb->vec[0], bb->vec[6], &distmin, &distmax)) {
                        float dist = distmin >= 0 ? distmin : distmax;
                        if (dist > distance) {
+                               goto finally;
                        }
                }
                else {
+                       goto finally;
                }
        }
 
@@ -372,6 +374,7 @@ static void rna_Object_ray_cast(
        }
 
        if (*r_success == false) {
+finally:
                zero_v3(r_location);
                zero_v3(r_normal);
                *r_index = -1;