Virtual Joystick - Always Visible

It seems there’s a bug with “alwaysVisible” for the “VirtualJoystick”. Setting the value to true has the exact same behaviour as if it was false.
I was expecting the joystick graphics container to always show. Am I missing something here?


cc @PolygonalSun

Hey @Jannick, I can take a look and see what’s going on.

So I took a look at the VirtualJoystick’s behavior with alwaysVisible and it looks like something may be up with the logic. I’ll work on a fix and update this thread when it’s in PR.

That’s great to hear! Godspeed to you!

1 Like

Hey, I just wanted to update this thread. It looks like the reason why it wasn’t working is because, when using the VirtualJoystick, the position needs to be set before the alwaysVisible boolean is set to true. When set alwaysVisible is set to true, the class looks for a place for the VirtualJoystick to appear and remain. If there is no position data, it sets alwaysVisible to false. I still feel like the logic could be cleaned up and documentation needs to be updated but try using the following to see if it unblocks you in the meantime:

// Set position of your VirutalJoystick to an absolute location on the screen
leftJoystick.setPosition(200, 200);
leftJoystick.alwaysVisible = true;
1 Like

Thanks! It makes sense, I will test it out asap :smile: