Rotating object with Gear/Go controller touchpad (SOLVED) — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Rotating object with Gear/Go controller touchpad (SOLVED)

AnneLantingAnneLanting Posts: 13
NerveGear
edited March 4 in Unity Development
Hello, 
In Unity 2017.4 i had a script to rotate in object with the touchpad of the controller, Gear-vr and Go. I started a new project in Unity 2018.3 (oculus integration 1.34), and used te same script. But it doesn't work anymore. This is the script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class KE_ObjectRotation : MonoBehaviour
{

    public GameObject ObjectToRotate;
    Vector3 objRotation = new Vector3(0f, 0f, 0f);
    public float objRotationSpeed = 60f;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        float TrackpadX = Input.GetAxis("Oculus_GearVr_DpadX");

        if (TrackpadX != 0f)
        {
            objRotation.y += TrackpadX * Time.deltaTime * objRotationSpeed;
            ObjectToRotate.transform.rotation = Quaternion.Euler(objRotation);
        }
    }
}  

Anyone understanding the problem?

Anne

Comments

  • radicalappdevradicalappdev Posts: 11
    NerveGear
    I'm just guessing, but I think it has to do with the way you are getting the X axis of the trackpad. Perhaps that was an old way of doing that before Oculus Go? Or maybe you have some input manager that uses that value?

    When I want to get the values from the trackpad I do this:

    private Vector2 touchpad;

    void Update()
    {     touchpad = OVRInput.Get(OVRInput.Axis2D.PrimaryTouchpad);     var xValue = touchpad.x; // Get the x axis of the touchpad 

  • AnneLantingAnneLanting Posts: 13
    NerveGear
    @ Radicalappdev: thanks for te suggestion, works fine !! Thats perhaps a better, future-proof, solution. Turns out i made a mistake in the code GearVr should be GearVR, then that works to. 
    Anne
Sign In or Register to comment.