BendGoal.cs 692 B

12345678910111213141516171819202122232425262728
  1. using UnityEngine;
  2. using System.Collections;
  3. using RootMotion.FinalIK;
  4. namespace RootMotion.Demos {
  5. /// <summary>
  6. /// Bend goal for LimbIK. Attach this to a GameObject that you want the limb to bend towards.
  7. /// </summary>
  8. public class BendGoal : MonoBehaviour {
  9. public LimbIK limbIK; // reference to the LimbIK component
  10. [Range(0f, 1f)]
  11. public float weight = 1f;
  12. void Start() {
  13. Debug.Log("BendGoal is deprecated, you can now a bend goal from the custom inspector of the LimbIK component.");
  14. }
  15. void LateUpdate () {
  16. if (limbIK == null) return;
  17. // Set LimbIK bend goal position to myself
  18. limbIK.solver.SetBendGoalPosition(transform.position, weight);
  19. }
  20. }
  21. }