I have been trying to edit the default CameraModule so that the camera does not clip through parts while mouse lock is enabled.
The problem is that the popper module uses the camera focus to decide whether or zoom the camera in. MouseLock sets the focus to next to your character. If the focus is inside the part, it will not detect anything between the focus and the actual camera position.
I tried editing the ZoomController and Popper modules to use your character’s head as the focus but it did not work.
Do mesh barriers work? Put a mesh inside of the part. It prevents cameras going through transparent parts without lock on, I wonder if it does the same for this issue.
Well whenever you have camera lock on, or you make your own 3rd person camera system, it doesn’t automatically prevent players from seeing through walls…
If the player is in the orbital type of camera (seen in most games), then the player won’t be able to see through CanCollide = true objects (most of the time) - which is where your idea was going (:
In the Poppercam module, on line 96, if you change
local zoom = ZoomController.Update(renderDt, rotatedFocus, extrapolation)
to
local zoom = ZoomController.Update(renderDt, game.Players.LocalPlayer.Character.Head.CFrame, extrapolation)
it works somewhat, the camera won’t go into the part as much, but it still does by about 2 studs? Changing the rotatedFocus variable to your character’s head cframe also breaks the poppercam when you are not in MouseLock.
I can’t tell you exactly which module to edit off the top of my head, but you can figure this out yourself. I would try to find the camera update loop that runs when the MouseLock is on. Just read through the modules and try to see track down the loop that runs during mouse lock.
Once you find the camera update loop, you can mess with the code that sets the CFrame of the camera to make sure that it doesn’t go through walls.
So, I was trying to see whats wrong with the code and I was going to compare it to the default code. But when I disabled your modified modules and just used the default camera modules, turns out that shift lock already takes walls into account.