[Bf-extensions-cvs] [1daa516] master: Expect input coordinates for the mesh projection function to be in world space for consistency.

Lukas Tönne noreply at git.blender.org
Wed Dec 10 14:17:32 CET 2014


Commit: 1daa51653ddede0e70d55f41dbc54cc7abfcb96e
Author: Lukas Tönne
Date:   Wed Dec 10 12:12:34 2014 +0100
Branches: master
https://developer.blender.org/rBAC1daa51653ddede0e70d55f41dbc54cc7abfcb96e

Expect input coordinates for the mesh projection function to be in world
space for consistency.

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

M	object_physics_meadow/duplimesh.py

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

diff --git a/object_physics_meadow/duplimesh.py b/object_physics_meadow/duplimesh.py
index c6e4f37..b67dae1 100644
--- a/object_physics_meadow/duplimesh.py
+++ b/object_physics_meadow/duplimesh.py
@@ -81,13 +81,15 @@ def interp_weights_face(verts, co):
 
 def project_on_ground(groundob, co):
     groundmat4 = groundob.matrix_world
+    inv_groundmat4 = groundmat4.inverted()
     groundmat3 = groundmat4.to_3x3()
     
     zmin = min(p[2] for p in groundob.bound_box) - 1.0
     zmax = max(p[2] for p in groundob.bound_box) + 1.0
     
-    ray_start = (co[0], co[1], zmax)
-    ray_end = (co[0], co[1], zmin)
+    obco = inv_groundmat4 * Vector(co[0:3] + (1.0,)) # co expected to be in world space
+    ray_start = (obco[0], obco[1], zmax)
+    ray_end = (obco[0], obco[1], zmin)
     
     hit, nor, index = groundob.ray_cast(ray_start, ray_end)
     if index >= 0:



More information about the Bf-extensions-cvs mailing list