Hi,
here is a javascript code how to vibrate your controllers, at least with a Meta Quest 3.
// for left contrroller
const xrSession = app.renderer.xr.getSession();
if (xrSession) {
for (const inputSource of xrSession.inputSources) {
if (inputSource.handedness === “left”) { // only left controller
const gamepad = inputSource.gamepad;
if (gamepad && gamepad.hapticActuators && gamepad.hapticActuators.length > 0) {
gamepad.hapticActuators[0].pulse(1.0, 100); // intensity 1.0 time 100ms
}
}
}
}
// for right controller
const xrSession = app.renderer.xr.getSession();
if (xrSession) {
for (const inputSource of xrSession.inputSources) {
if (inputSource.handedness === “right”) { // only right controller
const gamepad = inputSource.gamepad;
if (gamepad && gamepad.hapticActuators && gamepad.hapticActuators.length > 0) {
gamepad.hapticActuators[0].pulse(1.0, 100); // intensity 1.0 time 100ms
}
}
}
}
Now my question:
With the onhover puzzle, it will always detect the right or left controller.
How can I find out which controller hovers an object and then trigger the vibrate function
above?
Thanks Tom