Forum Discussion
AnneLanting
7 years agoHonored Guest
Rotating object with Gear/Go controller touchpad (SOLVED)
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
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
2 Replies
Replies have been turned off for this discussion
- radicalappdevProtegeI'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
} - AnneLantingHonored Guest@ 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
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 5 months ago