Replicating the roblox camera collision effect

Hello,

I have found this module that allows u to have a smooth camera. It works fine but the problem with it is that you can go through the ground with the camera, it has no collision.

I have tried my own solutions by using raycasts and overlapparams but i didnt manage to get the results i wanted. What is the best way to make the camera behave the same way the roblox camera does while keeping the smooth movement?

What i got:

What i want:

1 Like

You most likely raycasted incorrectly, the solution is simple raycast from the head position to the camera position then if it hits something position the camera to the result hit the spot

(Might want to offset it a bit from the hitpos to avoid it blocking camera view)

oh wait hahaha you’re right, I tried this and it seems to be working. Thanks!

1 Like