[Bf-extensions-cvs] [2283065] master: Update for changes to ray_cast

Campbell Barton noreply at git.blender.org
Wed Dec 2 12:01:41 CET 2015


Commit: 22830652fe2b1d3d2dca2854721dad678c9f2924
Author: Campbell Barton
Date:   Wed Dec 2 21:52:19 2015 +1100
Branches: master
https://developer.blender.org/rBA22830652fe2b1d3d2dca2854721dad678c9f2924

Update for changes to ray_cast

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

M	mocap/mocap_constraints.py

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

diff --git a/mocap/mocap_constraints.py b/mocap/mocap_constraints.py
index d9f41ea..4509193 100644
--- a/mocap/mocap_constraints.py
+++ b/mocap/mocap_constraints.py
@@ -300,15 +300,16 @@ def setConstraint(m_constraint, context):
         print("please wait a moment, calculating fix")
         for t in range(s, e):
             context.scene.frame_set(t)
-            axis = obj.matrix_world.to_3x3() * Vector((0, 0, 100))
+            axis = obj.matrix_world.to_3x3() * Vector((0, 0, 1))
             offset = obj.matrix_world.to_3x3() * Vector((0, 0, m_constraint.targetDist))
             ray_origin = (cons_obj.matrix * obj.matrix_world).to_translation() - offset  # world position of constrained bone
             ray_target = ray_origin + axis
             #convert ray points to floor's object space
             ray_origin = floor.matrix_world.inverted() * ray_origin
             ray_target = floor.matrix_world.inverted() * ray_target
-            hit, nor, ind = floor.ray_cast(ray_origin, ray_target)
-            if hit != Vector((0, 0, 0)):
+            ray_direction = ray_target - ray_origin
+            ok, hit, nor, ind = floor.ray_cast(ray_origin, ray_direction)
+            if ok:
                 bakedPos[t] = (floor.matrix_world * hit)
                 bakedPos[t] += Vector((0, 0, m_constraint.targetDist))
             else:



More information about the Bf-extensions-cvs mailing list