For a while now I’ve been meaning to force shift lock for my 3rd person game.Though I did find some ways to do this, they weren’t very efficient because I can’t find any methods to force it and stop forcing it if I(or the player) ever wanted to interact with the menu UI by pressing M.I know it’s possible to force shift lock in your game because I’ve seen it done in a few games before
(Dragon Ball Final Stand by @SnakeWorl for example) , I just don’t know how exactly to go about it or where to start.Is it possible you guys could help me out or at least link me to a good source on this topic?
I’m sure he didn’t mean literally forcing shift lock itself, but rather having the same functionality except where it’s toggle-able, as he did say it was for a third person game so I assume he wants the mouse to be locked at the center of the screen so that the player camera can face the direction you move your mouse, kind of like Fortnite.
Modal only frees the mouse in conditions where it’d normally be locked (i.e. zoomed in with a Gui plastered on your screen). It doesn’t force third person nor does it coerce the mouse to stay in the center of the screen.
You could achieve this functionality through editing the PlayerModule so that it is always on shift-lock mode, as opposed to only when the player makes it be. Id start by looking in the “MouseLockController” module or maybe “BaseCamera”, both children of CameraModule.
You will need to use the old camera script. If you put it in, the new control script should still be active. You can find one in free models and edit it your self.
If you want rotation you change you can also
GameSettings.RotationType = Enum.RotationType.CameraRelative
or
GameSettings.RotationType = Enum.RotationType.MovementRelative
Using this you can also set up certain conditions for when and if the camera will be forced in situations.
Also you can turn off the toggle players have for shift lock automatically if you go to StarterPlayer.EnableMouseLockOption.
This is nice. However, setting the activeCameraController to true does not immediately turn it on when the player joins. They still manually need to toggle shiftlock on and off for them to be stuck in it. I personally have tried settings the mouses X & Y to the middle of the screen when the mouse is moved but you cannot set these values only read from them. I do not know another method of doing this.
I have tried to use this, and it works for the most part. The only part that doesn’t is that it doesn’t do the third person thing. It just locks the mouse and turns the player with the camera, but doesn’t do the third person camera part. Any way I can add that?