WebXR controller button events

I’m looking for a way to get button events from xr controllers, but the only events that I’ve been able to get are “squeeze” and “select”, how would you go about getting buttons or axis events?

Original Post on Discord

by user 262331051802755072

You can access the underlying inputs via the WebXRController (cant look at the code right now)

It has also been asked in the forum before, maybe you can search here again too

searching!

by user 262331051802755072

WebXRController.input is what you need

Hi, Is there a way to enable and disable the VR controllers ? For example if I want to disable the left joystick or the entire left controller when some event happens, Is there a way to do it ?

by user 632418299711324161

Hey :wave:
In this thread, you can find how to disable the default controls.

You can also set the controller.gameobject.visible = false on the controller to hide it.

To disable the ray: .enableRaycasts = false
To hide the ray visually: .showRaycastLine = false

Thanks kipash ! : )

by user 632418299711324161

Hi again :slightly_smiling_face: , is there a way to disable the Miniature Mode ?

by user 632418299711324161

On the controller set enableDefaultControls to false

But in that case, I cannot move anymore, right ?

by user 632418299711324161

yes, it turns off all default controls

Okey, got it. One question, supose that we have a network room, one of the players has a Oculus and the rest is in mobile or desktop. If the Oculus player goes to VR, is there any way that the other players can see what is he/she seeing ? Like in the Collaborative Sandbox happens, where you can poses other’s player camera ?

by user 632418299711324161

There is a system for that yes. Spectator Cameras are most likely what you are looking for.

Perfect, I will try, thank you : )

by user 632418299711324161

It works ! At least in the Collaborative Sandbox it works perfectly ! I’m trying to reproduce that but using Player State + Synced Transform(in each PlayerPrefab instance) and an object with the Player Sync component.
I have attached the Spectator Camera to my PlayerPrefab but i got an error :
image.png

by user 632418299711324161

This is how my PlayerPrefab locks :

by user 632418299711324161

by user 632418299711324161

Do you know why it cannot find the camera ?

by user 632418299711324161

I think the spectator camera script just needs to be present in the scene once and not on each prefab.