Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to create a popper camera?

Asked by 6 years ago

Hey guys, so I have a custom camera script that locks the camera at a certain distance from the character's HumanoidRootPart (General code structure shown below). As you may notice from line 5, I accomlish this by restricting the camera's CFrame. However, this causes a gameplay problem because the camera does not "zoom in" when the player is blocked from the camera by another object in the workspace. So essentially, the player can look through walls by pointing the camera at specific angles. Is there any way I can solve this issue, and recreate a popper camera? I would really appreciate any pieces of advice.

--Defined some variables
camera.CameraType = "Scriptable"
--Some code
game:GetService("RunService").RenderStepped:connect(function()
    camera.CoordinateFrame = hrp.CFrame *  CFrame.new(5,-1,14)
    --Some more irrelevant code
end)

Answer this question