Working with UMA characters » FinalIKIntegration.cs
1 |
using System.Collections; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using UnityEngine; |
4 |
using RootMotion; // Need to include the RootMotion namespace as well because of the BipedReferences |
5 |
|
6 |
|
7 |
public class FinalIKIntegration : MonoBehaviour |
8 |
{
|
9 |
|
10 |
// Start is called before the first frame update
|
11 |
void Start() |
12 |
{
|
13 |
|
14 |
}
|
15 |
|
16 |
// Update is called once per frame
|
17 |
void Update() |
18 |
{
|
19 |
|
20 |
}
|
21 |
|
22 |
public void Integrate(UMA.UMAData umaData) |
23 |
{
|
24 |
//this adds the FBBIK component to your character
|
25 |
RootMotion.FinalIK.FullBodyBipedIK fbbik = gameObject.AddComponent<RootMotion.FinalIK.FullBodyBipedIK>(); |
26 |
|
27 |
//this will set the references for your character
|
28 |
BipedReferences references = null; |
29 |
BipedReferences.AutoDetectReferences(ref references, fbbik.transform, BipedReferences.AutoDetectParams.Default); |
30 |
fbbik.SetReferences(references, null); |
31 |
|
32 |
//this will set the orientation of your character's limbs
|
33 |
fbbik.solver.SetLimbOrientations(BipedLimbOrientations.UMA); |
34 |
}
|
35 |
}
|