Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
CrispyCritter86's avatar
CrispyCritter86
Honored Guest
7 years ago

OVRPlayerController dash implementation not working

I've been attempting to implement a dash into my game, but have not had any luck. It looks like pre-made code on the OVRPlayerController keeps my script from working, but I can't figure out what's going on. Here is what I have attempted to take the rigid body I threw on the player and force it forward when the left thumbstick is clicked in....

//dashing variables
    public Rigidbody rb;
    float speed = 5f;

 void Start()
{
        //grabs rigidbody for dashing
        rb = GetComponent<Rigidbody>();
    }

void FixedUpdate()
    {
        if (OVRInput.GetDown(OVRInput.Button.PrimaryThumbstick))
        {
            //Player dash forward script
            rb.MovePosition(rb.position + Vector3.forward * speed * 2 * Time.deltaTime);
        }
        

1 Reply

Replies have been turned off for this discussion
  • Hi Oculus staffs,

    I used a prefab 'OVRPlayerController' to understand how Oculus Rift and Touch work, but I got the same problem here and it really depressed me. No matter which button or axis I added in script is not working. I've checked the OVRInput.GetActiveController() and OVRInput.GetConnectedControllers() both return 'Touch' which I guess the controllers are connected, meanwhile the OVRInput.GetLocalControllerAcceleration() works fine. Not pretty sure if there's any part that I didn't notice or did wrong.
    My environment shown in Unity is Unity v2018.3.12f1, Oculus Utilities v1.32.0, OVRPlugin v1.32.0, SDK v1.36.0.
    [Update May 2 2019]
    The buttons are functional in exe mode, but why it can't also workable in Unity Editor?

    Please help. Thanks!

    Code snippet in OVRPlayerController.cs
    UpdateMovement()
    {
        // ...
        if (OVRInput.Get(OVRInput.Button.Start))
        {
            Debug.Log("Start trigger");
        }
        if (OVRInput.Get(OVRInput.RawButton.Start))
        {
            Debug.Log("Raw Start trigger");
        }
        // ...
    }