jorgejgnz / HPTK

Hand Physics Toolkit
MIT License
330 stars 32 forks source link

HPTK with new Input System and XR Origin #16

Closed EphTron closed 10 months ago

EphTron commented 2 years ago

I am running into an issue when setting up HPTK with Unity 2020.3.34. I setup a clean project and installed:

I added the HPTK package and followed the instructions here (https://jorge-jgnz94.gitbook.io/hptk/setup) -> changed Physic settings, added HPTK layer, set XR Plugin Managment to OpenXR. Playmode Run time to Oculus, added Oculus Touch Controller to Interaction profiles. Then I added the DefaultSetup.UnityXR prefab and the DefaultAvatar.Standard to my scene. In the DefaultSetup I exchanged the XRRig with a XR Origin and replaced the ref of the HPTK 'Tracked Camera' and 'Tracked Space' to the new XR Origin. I also added an Input Action Manager to the XR Origin. In the DefaultAvatar I added the left and right hand meshes to the Representation>Hand.L/R>Slave/Master to have the hands visible.

When I run this setup I get the error "Controller for Left/Right side was not found! Interrupting update" HandPhysicsToolkit.Input.UnityXRControllerTracker:UpdateData () (at Assets/HPTK/Runtime/Input/InputDataProviders/UnityXRControllerTracker.cs:78) HandPhysicsToolkit.Modules.Hand.Input.InputController:ControllerUpdate () (at Assets/HPTK/Runtime/Modules/Hand/Input/InputController.cs:136) HandPhysicsToolkit.HPTKController:Update () (at Assets/HPTK/Runtime/Modules/Abstracts/HPTKController.cs:36)

Does the HPTK package not support the new Input System? Can I use the HPTK package with OpenXR without the new Input System? I would be grateful for any help or advice. Cheers

jorgejgnz commented 2 years ago

Hi! It seems UnityXRControllerTracker, the input data provider for UnityXR, was not able to find any active device with the characteristic "HeldInHand" enabled.

As you're using XR Interaction Toolkit, you should have "XR Controller (Device based)" components in XR Origin > Camera Offset > Left/RightHand Controller.

If so, would you mind to write the output you're getting when you use the following component in your scene while using your VR controllers?

using UnityEngine;
using UnityEngine.XR;
using UnityEngine.XR.Interaction.Toolkit;

public class DeviceInfo : MonoBehaviour
{
    public XRController controller;

    void Start()
    {
        if (controller != null)
        {
            InputDevice device = controller.inputDevice;
            Debug.Log("Manuf:[" + device.manufacturer + "] Name:[" + device.name + "]\n";);
            Debug.Log(device.characteristics.ToString());
        }
    }
}
jorgejgnz commented 10 months ago

This issue has received no response and will be closed.