Skip to content

Cyberboyht/Project-Virtual-reality

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Project-Virtual-reality

Project realite virtuel avec C# et Unity using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem;

public class AnimScript : MonoBehaviour { [SerializeField] InputActionReference gripInputAction; [SerializeField] InputActionReference triggerInputAction;

Animator handAnimator;

private void Awake()
{
    handAnimator = GetComponent<Animator>();
}

private void OnEnable()
{
    gripInputAction.action.performed += GripPressed;
    triggerInputAction.action.performed += TriggerPressed;
}

private void OnDisable()
{
    gripInputAction.action.performed -= GripPressed;
    triggerInputAction.action.performed -= TriggerPressed;
}

private void TriggerPressed(InputAction.CallbackContext obj)
{
    handAnimator.SetFloat("Trigger", obj.ReadValue<float>());
}

private void GripPressed(InputAction.CallbackContext obj)
{
    handAnimator.SetFloat("Grip", obj.ReadValue<float>());
}

}

About

Project realite virtuel avec C# et Unity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published