Download

Clamping rotation for a Joystick in VR

Hi! I’ve started a new project for VR and I’ve been trying to develop a virtual joystick (for locomotion). For the most part it’s been working as expected. The joystick’s logic is extremely primitive, it just uses a look at rotation node to face the controller, with a clamp on the Y rot to mimic the little ridge on the bottom of all joysticks.

VIDEO: https://i.imgur.com/7tBb9qk.mp4

The problem comes when the joystick base is rotated, as the find look at rotation uses world rotation values, the clamping goes out of sync:

I’ve been trying to think of a solution but I’m very inexperienced with vector math, and so far all workarounds haven’t really worked. Any suggestions would be very much appreciated!

1 Like