Better Mobile/Console Shiftlock | A mobile/console shiftlock with PC parity!

mouseLock_on@2x
Better Mobile/Console Shiftlock


A better mobile/console shiftlock implementation with proper parity to PC shiftlock, without forking PlayerModule.
No more mobile players spinning objects they're welded to!

demonstration

The most popular mobile shiftlock from the toolbox seen on the left of the screen, and this implementation seen on the right of the screen.

What’s the difference?


This implementation uses UserGameSettings.RotationType, which is the property used by the default PlayerModule MouseLockController, avoiding setting the CFrame directly, so it behaves exactly the same as on PC.

  • This fixes the many issues caused by setting the CFrame, such as mobile players being able to spin objects they’re welded to, or spin while sitting.

This implementation also has much cleaner code, and uses newer APIs (such as UserInputService.PreferredInput).

Installation


Place the ScreenGui in StarterGui (or your preferred location), and you’re set! No PlayerModule fork necessary.

Get it on Roblox!Get it on GitHub!
Released under the MIT License. In short: you’re free to use, copy, modify, and redistribute this software.

24 Likes

Cool utility.

Thought though: Wouldn’t it be faster to extract the color and update the Color3 of the image, instead of using a new image? That way the icon looks seamless and changes between Blue and white properly?

I ask because i saw this in the example thumbnail.

The icons are actually included with the client (rbxasset://textures/ui/mouseLock_off@2x.png), meaning they should be visible immediately and it gives developers the freedom to use different icons, you’re free to change the behavior to color if you like.

Maybe include an option somewhere to be able to use one icon and two colors?

I would assume it to still be faster to tint the icon in-memory, a more GPU-intensive task, than override it with another icon.

The icons are pretty low resolution so they shouldn’t take up much memory, other Roblox UIs do this too, I don’t think an included option is necessary but you’re free to edit it however you like.

1 Like

Version 0.2.0

  • Shiftlock state is now tracked internally instead of relying on UserGameSettings.RotationType.
    • This fixes the button showing shiftlock is enabled in first person.
  • Camera offset is now set to Vector3.zero when in first person, which is how shiftlock on desktop behaves.
  • Removed getting camera offset from MouseLockController as it was unnecessary.

Updating

If you already have the previous version installed, you can right click on the MobileShiftlock gui, and click Get Latest Package to update.

Apparently packages can’t be distributed yet, you’ll need to download the latest version and replace the existing.

1 Like

any chance for console compatability?

1 Like

Just updated it to include this!

Version 0.3.0

Updating

Get the latest version from the Creator Store or GitHub and replace the old version.

1 Like