| | | 1 | | using System.Collections; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using UnityEngine; |
| | | 4 | | using UnityEngine.Animations; |
| | | 5 | | using UnityEngine.InputSystem; |
| | | 6 | | public class AnimateHandOnInput : MonoBehaviour |
| | | 7 | | { |
| | | 8 | | [SerializeField] InputActionProperty pinchAnimationAction; |
| | | 9 | | [SerializeField] InputActionProperty gripAnimationAction; |
| | | 10 | | |
| | | 11 | | |
| | | 12 | | [SerializeField] Animator handAnimator; |
| | | 13 | | // Start is called before the first frame update |
| | | 14 | | void Start() |
| | 0 | 15 | | { |
| | | 16 | | |
| | 0 | 17 | | } |
| | | 18 | | |
| | | 19 | | // Update is called once per frame |
| | | 20 | | void Update() |
| | 0 | 21 | | { |
| | 0 | 22 | | float triggerValue = pinchAnimationAction.action.ReadValue<float>(); |
| | 0 | 23 | | handAnimator.SetFloat("Trigger", triggerValue); |
| | | 24 | | |
| | 0 | 25 | | float gripValue = gripAnimationAction.action.ReadValue<float>(); |
| | 0 | 26 | | handAnimator.SetFloat("Grip", gripValue); |
| | | 27 | | |
| | | 28 | | //Debug.Log(triggerValue); |
| | 0 | 29 | | } |
| | | 30 | | } |