randomrandom1222

Untitled

Jul 4th, 2025
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | Source Code | 0 0
  1. using UnityEngine;
  2. using UnityEngine.InputSystem;
  3.  
  4. public class handcontroller : MonoBehaviour
  5. {
  6.     public InputActionReference gripIn;
  7.     public InputActionReference trigIn;
  8.    
  9.     private Animator m_Animator;
  10.  
  11.     private void Awake()
  12.     {
  13.         m_Animator = GetComponent<Animator>();
  14.     }
  15.  
  16.     private void Update()
  17.     {
  18.         if (!m_Animator) return;
  19.         float grip = gripIn.action.ReadValue<float>();
  20.         float trigger = trigIn.action.ReadValue<float>();
  21.         m_Animator.SetFloat("grip", grip);
  22.  
  23.         m_Animator.SetFloat("trigger", trigger);
  24.  
  25.         Debug.Log(trigger);
  26.         Debug.Log(grip);
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment