@Moonvane i know im late but i just got this problem xD.
can you explain this line
local finalCF = CFrame.new(CF1.p) * currentAngle:Lerp(desiredAngle, 0.5)
I’m kinda new to lerping. from what i learned so far when you lerp. it’ll be something like this.
Part.Cframe = Part.Cframe:Lerp(goal, alpha)
this will lerp the parts current CFrame to the new CFrame.
local finalCF = CFrame.new(CF1.p) * currentAngle:Lerp(desiredAngle, 0.5) <— how does this change the angle without CFrame.Angles and why is it a variable
this is why i need to lerp.
I have a line of code that will change the camera’s lookat direction.
cam.CFrame = CFrame.lookAt(head.Position, head.Position + ToCFrame) * CFrame.Angles(0, math.rad(-90), 0)
ToCFrame is just the normal of the wall. this line will make the camera always face parallel to the detected wall. the problem is if the camera changes angle and is too snappy. so I am trying to lerp the camera orientation so it’s smooth when it changes to a new lookat direction.
so what i did was get the orientation of the CFrame.Lookat
local Goal = CFrame.lookAt(head.Position, head.Position + ToCFrame) * CFrame.Angles(0, math.rad(-90), 0)
local GoalX, GoalY, GoalZ = Goal:ToOrientation()
now i am trying to lerp the camera’s orientation and not the position since lerping the position will slow it down and not make it stick to the player.
it would be better if you can also tell me how i can lerp just the horizontal axis of the orientation as i don’t need the rest to be lerped
I hope you can help. sorry for writing too much i tried to explain my problem to make it clear