From 22830652fe2b1d3d2dca2854721dad678c9f2924 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 2 Dec 2015 21:52:19 +1100 Subject: Update for changes to ray_cast --- mocap/mocap_constraints.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mocap/mocap_constraints.py b/mocap/mocap_constraints.py index d9f41ea1..4509193c 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: -- cgit v1.2.3