Hi there,
I'm kind of new to Unity. I want to try to get the position of the thumb on a vive controller touchpad.

It should send the x and y coordinates at all time a finger is placed on the touchpad. I already tried it with the code at the end of the post. I wrote this code and applied it to an Empty object which is the parent to the SteamVR Player Prefab. I also added an additional Action the controller called touchpadPosition and tried to apply it to the trackpad in the UI but this kind of stucks in the saving mode when I try to save the default binding:

I also get the constant error:
NullReferenceException: Object reference not set to an instance of an object
Valve.VR.SteamVR_Action_Vector2.get_axis () (at Assets/Steam/SteamVR/Input/SteamVR_Action_Vector2.cs:46)
VRController.getPosition () (at Assets/Scripts/VRController.cs:27)
VRController.Update () (at Assets/Scripts/VRController.cs:21)
I guess there are many problems with that. Maybe someone could help me.
This is the code I used:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;
public class VRController : MonoBehaviour
{
public SteamVR_Action_Vector2 m_MoveValue = null;
private float test = 0.0f;
private CharacterController m_CharacterController = null;
private void Awake()
{
m_CharacterController = GetComponent<CharacterController>();
}
private void Update()
{
getPosition();
}
private void getPosition()
{
test = m_MoveValue.axis.y;
Debug.Log(test);
}
}
Hi there,
I'm kind of new to Unity. I want to try to get the position of the thumb on a vive controller touchpad.
It should send the x and y coordinates at all time a finger is placed on the touchpad. I already tried it with the code at the end of the post. I wrote this code and applied it to an Empty object which is the parent to the SteamVR Player Prefab. I also added an additional Action the controller called touchpadPosition and tried to apply it to the trackpad in the UI but this kind of stucks in the saving mode when I try to save the default binding:
I also get the constant error:
NullReferenceException: Object reference not set to an instance of an object
Valve.VR.SteamVR_Action_Vector2.get_axis () (at Assets/Steam/SteamVR/Input/SteamVR_Action_Vector2.cs:46)
VRController.getPosition () (at Assets/Scripts/VRController.cs:27)
VRController.Update () (at Assets/Scripts/VRController.cs:21)
I guess there are many problems with that. Maybe someone could help me.
This is the code I used: