Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Oculus quest 2 buttons not working

Discussion in 'XR Interaction Toolkit and Input' started by brbck, Nov 24, 2022.

  1. brbck

    brbck

    Joined:
    Nov 20, 2020
    Posts:
    8
    Hi,

    I've ran into a problem this week. I'm using a previously working setup(literally copied from another scene) that is for some reason not working. I have zero idea what's wrong, I've been stuck for days.

    Here's my action map:
    teet.png

    Here's my script(also a copy from the previous working scene):
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Events;
    5. using UnityEngine.InputSystem;
    6.  
    7.  
    8. public class CharControl : MonoBehaviour{
    9.  
    10.     MOPinputs montrols;
    11.     RaycastHit hit;
    12.     Animator Lm_Animator;
    13.     Animator Rm_Animator;
    14.  
    15.     public GameObject LL_target;
    16.     public GameObject RL_target;
    17.  
    18.     public float animationSpeed;
    19.    
    20.  
    21.     public bool anim_control;
    22.  
    23.     void Start(){
    24.  
    25.         Rm_Animator = RL_target.GetComponent<Animator>();
    26.  
    27.         Lm_Animator = LL_target.GetComponent<Animator>();
    28.  
    29.        
    30.     }
    31.    
    32.     private void Awake(){
    33.  
    34.         montrols = new MOPinputs();
    35.     }
    36.    
    37.     private void OnEnable(){
    38.  
    39.         montrols.Player.Enable();
    40.         montrols.Player.switchCamera.performed += switchTHECamera;
    41.     }
    42.  
    43.    
    44.     private void switchTHECamera(InputAction.CallbackContext context){
    45.  
    46.         Debug.Log("started");
    47.     }
    48.  
    49.     void Update(){
    50.  
    51.         Debug.Log(montrols.Player.Move.ReadValue<Vector2>());
    52.        
    53.  
    54.  
    55.         if(anim_control == true){
    56.  
    57.             Rm_Animator.speed = animationSpeed *     Mathf.Clamp(Mathf.Abs(montrols.Player.Move.ReadValue<Vector2>().x + montrols.Player.Move.ReadValue<Vector2>().y), 0, 1);
    58.             Lm_Animator.speed = animationSpeed * Mathf.Clamp(Mathf.Abs(montrols.Player.Move.ReadValue<Vector2>().x + montrols.Player.Move.ReadValue<Vector2>().y), 0, 1);
    59.         }
    60.         else{
    61.  
    62.             Rm_Animator.speed = animationSpeed;
    63.             Lm_Animator.speed = animationSpeed;
    64.         }
    65.        
    66.        
    67.     }
    68.  
    69. }
    70.  
    I'm quite new to making vr games, so I might made a beginner mistake somewhere.

    Thanks,

    Ábris