Creating a smooth poppercam

When creating custom camera systems, a “poppercam” is sometimes used to change the camera’s fixed distance from the avatar so that it does not clip objects such as walls and floors.

How does one best achieve a smooth transition between the distances? I have heard about some games using separate “whisker rays” to analyse the surfaces adjacent to the normal ray to help predict this smooth curve… but I am struggling to understand how it all fits together in practise.

This problem gets even more confusing to me when we have more extreme terrain with gaps and bumps:
image

Could anyone share some insight into how a system like this could be implemented at a general level?

1 Like

Use CFrame:Lerp(). This will allow you to create a smooth poppercam.

This would cause clipping


The blue represents the lerped version; red original

You need to account for that using math. I’m sure there’s a way to do so.