My character animation flow needs to be keyframed when the "child of 01" value is 1 and the "child of 02" value is 0, and then curve optimization is performed when the "child of 01" value is 0 and the "child of 02" value is 1. But I need to keep the bone pose in place when I switch the influence value of the constraint. One of the difficulties is that this bone does not have a parent object, but it needs to be offset according to different parent objects. I tried to reset the "matrix_basis" to the default, and then got the new "matrix", but I don't know how to calculate it with the old "matrix".

My idea is to record bones and world space transformations. Then through inverse calculation, set the new transform to the bones with the constraint turned off.

Through This, I learned how to do the first step, Then I did a lot of attempts on the inverse calculation and setting the bone transformation, but I couldn't.

test step:

#1.I have an armature(two bone) 
#2.pose mode -> select bones
#3.record bones and record bone1 matrix (Relative toarmature)
a = c.selected_pose_bones_from_active_object
om = a[1].matrix

#4. Manual transform
#5.get matrix of current transform
a[1].matrix_basis = Matrix(((1.0, 0.0, 0.0, 0.0),(0.0, 1.0, 0.0, 0.0),(0.0, 0.0, 1.0, 0.0),(0.0, 0.0, 0.0, 1.0)))
newMatrix = Matrix(a[1].matrix)
#7.Compute local matrix
tempMatrix = newMatrix @ om #tempMatrix = om @ newMatrix 
#8.set property
a[1].location = tempMatrix.to_translation()

##.But it has no effect. Or the effect is confusing
| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.