Answered

How to set FK/IK Blend by code (UMotion API)

Paul MPI 3 weeks ago updated by Peter - Soxware Developer 3 weeks ago 1

Dear Peter,

I'm trying to standardize the feet placement of about 150 mocapped gesture animations. Through the UMotion API I'm able to set the position and rotation of the IK_Foot_X objects but by default, the FK/IK Blend slider is set to 0.

When I request all the custom constraints by GetCustomPropertyConstraintNames I get an empty list. The feet IK have been set up by the IK Setup Wizard and the project is Humanoid.

Is there a way to set the FK/IK blend slider by code so I can automate adjustments and export them all at once?

Example code:

var targetObject = GameObject.Find("rp_sophia_animated_003_idling_ball_l").transform;
PoseEditor.TrySetFkLocalRotation(targetObject, Quaternion.Euler(0f, 0f, 90f), "rotate ball L", false);
targetObject = GameObject.Find("rp_sophia_animated_003_idling_ball_r").transform;
PoseEditor.TrySetFkLocalRotation(targetObject, Quaternion.Euler(0f, 0f, 90f), "rotate ball R", false);

targetObject = GameObject.Find("IK_Foot_R").transform;
var IKFootRPosition = new Vector3(0.08681f, 0.08425f, 1.64067f);
PoseEditor.TrySetFkWorldPosition(targetObject, IKFootRPosition, "IK Foot R Pos", false);
var IKFootRRotation = Quaternion.Euler(1.8f, 277.1f, 89.4f);
PoseEditor.TrySetFkWorldRotation(targetObject, IKFootRRotation, "IK Foot R Rot", false);

List names = new List();
PoseEditor.GetCustomPropertyConstraintNames(targetObject, names);
Debug.Log($"{targetObject.name} names count: {names.Count}");

UMotion Version:
1.29p04
Unity Version:
2022.3.55f1

Answer

Answer
Answered

Dear Paul,
thank you very much for your support request.

Unfortunately, the GetCustomPropertyConstraintNames() is about the Custom Property Constraint and does not return properties of the IK Constraint. Sadly there is currently no way to query the "FK/IK Blend" property via the UMotion API.


I agree that this is a shortcoming and have added it to my todos for the future.

Please let me know in case you have any follow-up questions.


Best regards,
Peter

GOOD, I'M SATISFIED

Thanks for the quick reply! I already expected it would not be possible so I started doing certain actions manually. Nevertheless, UMotion helped me a lot in the process of fixing the mocapped animations!

As an added feature request, it also would've helped me a lot to be able to delete keys (both current frame and all frames of the animation within selected animation properties).

Satisfaction mark by Paul MPI 3 weeks ago
Answer
Answered

Dear Paul,
thank you very much for your support request.

Unfortunately, the GetCustomPropertyConstraintNames() is about the Custom Property Constraint and does not return properties of the IK Constraint. Sadly there is currently no way to query the "FK/IK Blend" property via the UMotion API.


I agree that this is a shortcoming and have added it to my todos for the future.

Please let me know in case you have any follow-up questions.


Best regards,
Peter