Humanoid.CameraOffset question

I’m making a lean system but when I use the aforementioned property it allows the camera to move through parts [walls and such]. is there any way to prevent this?

you could use a raycast to cast in the leaning directions (assuming left and right relative to the player), you could also use a spherecast instead of a raycast if needed

some pseudocode (not sure if this works):

local leanRightDirection = root.CFrame.RightVector * leanDistance
local leanLeftDirection = -leanRightDirection

local rightLeanResult = workspace:Raycast(root.Position, leanRight)
local leftLeanResult = workspace:Raycast(root.Position, leanLeft)

if not rightLeanResult and not leftLeanResult then
print("no obstacles in both side!!!! yay!!!!!")
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.