3rd party integration

From UMAWiki
Revision as of 04:15, 22 November 2016 by Virror (talk | contribs)

Jump to: navigation, search

Here is a collection of tips and tricks for getting other assets to work with UMA.

Final IK

FullBodyIK

You need to add the FullBodyIK during runtime. Just hook in to the CharacterCreated callback on your UMA and add the following code:

 1 using RootMotion; // Need to include the RootMotion namespace as well because of the BipedReferences
 2 FullBodyBipedIK ik;
 3 
 4 void AddFBBIK (GameObject go, BipedReferences references = null) {
 5     if (references == null) { // Auto-detect the biped definition if we don't have it yet
 6         BipedReferences.AutoDetectReferences(ref references, go.transform, BipedReferences.AutoDetectParams.Default);
 7     }
 8     ik = go.AddComponent<FullBodyBipedIK>(); // Adding the component
 9     ik.SetReferences(references, null);
10     ik.solver.SetLimbOrientations(BipedLimbOrientations.UMA); // The limb orientations definition for UMA skeletons
11 }

VRIK

You need to add the VRIK during runtime. Just hook in to the CharacterCreated callback on your UMA and add the following code:

1 using RootMotion.FinalIK;
2 
3 vrik = go.AddComponent<VRIK>(); // Adding the component
4 vrik.AutoDetectReferences();
5 
6 vrik.solver.leftArm.shoulderRotationMode = IKSolverVR.Arm.ShoulderRotationMode.FromTo;
7 vrik.solver.rightArm.shoulderRotationMode = IKSolverVR.Arm.ShoulderRotationMode.FromTo;