AimSwing.cs 485 B

1234567891011121314151617
  1. using UnityEngine;
  2. using System.Collections;
  3. using RootMotion.FinalIK;
  4. namespace RootMotion.Demos {
  5. public class AimSwing : MonoBehaviour {
  6. public AimIK ik;
  7. [Tooltip("The direction of the animated weapon swing in character space. Tweak this value to adjust the aiming.")] public Vector3 animatedSwingDirection = Vector3.forward;
  8. void LateUpdate () {
  9. ik.solver.axis = ik.solver.transform.InverseTransformVector(ik.transform.rotation * animatedSwingDirection);
  10. }
  11. }
  12. }