Custom ShiftLock

Hey!

I’m trying to recreate a custom shiftlock system similar to the one used in Basketball Zero:

Here’s what I’ve done so far:

When shift lock is enabled, I hide the actual mouse and lock it to the center of the screen.
Then I show a frame at the center to act as a custom cursor.
The character rotates to face the direction of the camera just like normal shiftlock.

Everything works fine, but here’s what I don’t understand:

How do they make it so that the center of the screen (cursor) always points toward a specific position above the character’s head, even when zooming in or out?

My guess is that they’re adjusting the CameraOffset based on zoom level, but I’m not sure how exactly that works.

	local humanoid : Humanoid = character:WaitForChild("Humanoid")
	
	humanoid.CameraOffset = Vector3.new(0, 1, 0)

Yes, i already did that, but if i zoom out, the center of the screen/the cursor wont stay above the player’s head.

What i’m trying to achieve is that no matter the zoom level, the center of the screen always stays like 2cm above the player’s head, just like in the clip

Can you show a video of your issue? The clip you showed is only using CameraOffset with its default behaviour.

I think I see the issue. The false cursor you have isn’t centred. Check that the ScreenGui has IgnoreGuiOffset set to true and that it is positioned exactly at (0.5, 0, 0.5, 0) with AnchorPoint (0.5, 0.5)

Can’t he just use Mouse.Icon to set the icon of the mouse?

It was IgnoreGuiInset, thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.