VirtualJoysticksCamera right joystick rotate speed

I am using VirtualJoysticksCamera, even though I set the camera.speed it only affects left/right/forward/backward but does not affect the camera’s rotation/turning speed on the right virtual joystick.

What is the way to set the speed of the right joystick? Angularsensibility doesn’t work as it seems to be only for desktop mouse pointer only.

You are right, it does not look like there is a way to control it, would you fancy doing a PR for it ?

Else I could volunteer either @PirateJC or @PolygonalSun to have a look ?

I did find a way to use it but from TypeScript, it is a bit of a blackbox in that you need to recast with an ANY type and blindly access private variables (after accurately figuring out the object properties)

The below is a hackish way of doing it in Typescript.

let vjc: any = this.scene.activeCamera // assuming activeCamera is VirtualJoysticksCamera

     if (vjc != null) {

        //console.log(vjc.inputs.attached.virtualJoystick._rightjoystick._joystickSensibility);

        vjc.inputs.attached.virtualJoystick._rightjoystick.setJoystickSensibility(0.1);

        //console.log(vjc.inputs.attached.virtualJoystick._rightjoystick._joystickSensibility);

     }

vjc.inputs.attached.virtualJoystick.getRightJoystick().setJoystickSensibility would already be one step closer.

But attached is not a virtualJoystick it is the export class FreeCameraVirtualJoystickInput which should contain it ?

Ok thanks, got it. Just tried it, works as well.

1 Like

Here’s my code for anyone interested. It casts and retrieve the FreeCameraVirtualJoystickInput and if it is not null then call the setJoystickSensibility function.

(<BABYLON.FreeCameraVirtualJoystickInput>this.camera.inputs.attached.virtualJoystick)?.getRightJoystick().setJoystickSensibility(0.1);

1 Like