I’m making a camera offset, and currently the camera can go through walls. How would I fix this?
code so far (doesn’t work well, is in a renderstepped):
local Cast = workspace:Raycast(HumanoidRootPart.Position,Humanoid.RootPart.CFrame.RightVector * 1.5,Params)
if Cast then
Humanoid.CameraOffset = Vector3.new((HumanoidRootPart.Position.X - Cast.Position.X),Humanoid.CameraOffset.Y,Humanoid.CameraOffset.Z)
print(Cast.Distance)
else
Humanoid.CameraOffset = Vector3.new(1.5,Humanoid.CameraOffset.Y,Humanoid.CameraOffset.Z)
end