Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Vector3 offset_target;
- private Animator mAnimator;
- public Transform target;
- Vector3 targetPosition;
- Vector3 dampVelocity;
- // Use this for initialization
- void Start () {
- mAnimator = GetComponent<Animator>();
- }
- void Update () {
- }
- void OnAnimatorIK() {
- if (activeIK == false) {
- mAnimator.SetLookAtWeight (0, 0, 0, 0, 0);
- }
- else {
- targetPosition = Vector3.SmoothDamp(targetPosition, target.position, ref dampVelocity, 0.2f);
- mAnimator.SetLookAtPosition (target.position);
- mAnimator.SetLookAtWeight (1, 1 , 1, 1, 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement