diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-12-02 13:52:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-02 13:52:19 +0300 |
commit | 22830652fe2b1d3d2dca2854721dad678c9f2924 (patch) | |
tree | 3602594042d83ad26d86d84f61f0ea1e9dda9ec5 | |
parent | 96ac71a2f0ac696eb863541792793044abd53d17 (diff) |
Update for changes to ray_cast
-rw-r--r-- | mocap/mocap_constraints.py | 7 |
1 files 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: |