GetLargestCutoffDistance for a custom camera

development
scripting
camera

#1

Hey everyone,
I am attempting to create a custom camera that is smoother and allows for me to use roll and pan, and I’ve accomplished that portion, however the camera doesn’t have the “poppercam” effect where it adjusts the lookvector of the camera’s cframe to avoid obstacles.

How would I go about using GetLargestCutoffDistance for my custom camera?
I’ve inserted the value from GetLargestCutoffDistance into my script and it wants to avoid the obstacles, but it only jitters around where it should be staying still. It also rests inside of the obstacle, not between the character and said obstacle.

Visual:

Output included:

Again, how do I eliminate the jitter and make the position of the camera be “in front” of the obstacle?
Much appreciated.


#2

Problem solved
In case anyone else had this issue, I solved it by using a custom CFrame value called “offset” that is where the camera is supposed to be, and raycasting from the focus to the “offset”. As long as any parts cross that ray, I find the length of the ray and apply that to the actual camera’s cframe which is “offset” * the cutoff.