holopy3/Assets/Plugins/RootMotion/FinalIK/_DEMOS/Limb IK/Scripts/BendGoal.cs

28 lines
692 B
C#
Raw Normal View History

2020-12-10 14:25:12 +00:00
using UnityEngine;
using System.Collections;
using RootMotion.FinalIK;
namespace RootMotion.Demos {
/// <summary>
/// Bend goal for LimbIK. Attach this to a GameObject that you want the limb to bend towards.
/// </summary>
public class BendGoal : MonoBehaviour {
public LimbIK limbIK; // reference to the LimbIK component
[Range(0f, 1f)]
public float weight = 1f;
void Start() {
Debug.Log("BendGoal is deprecated, you can now a bend goal from the custom inspector of the LimbIK component.");
}
void LateUpdate () {
if (limbIK == null) return;
// Set LimbIK bend goal position to myself
limbIK.solver.SetBendGoalPosition(transform.position, weight);
}
}
}