So Basically i have a script that detects walls on the side of the player using raycast and then makes the player and camera face parallel to the wall.
the problem is that when the camera changes its direction it’s too snappy it directly changes to the new direction which makes it look too bad. I want to make the camera smoothly change the angle using lerp.
the line above is what I use to change the camera direction. The Bold part mainly controls the horizontal direction (which is what I need to lerp I want the rest to continue behaving as they are) I don’t want the camera’s position to be lerped I also don’t want the camera’s up and down orientation to be lerped.
How can I lerp only the camera’s angles and not its position.
Can you help me change the code above so that it works how I want it?
Too lazy to finish reading this, but try using the CFrame:Lerp() method of CFrame. Depending on how fast you want the camera to move, you can change the lerp value as you change the camera’s cframe again.
This is how it looks when i was messing around with lerp. the position is also being lerped its not fixed. i don’t want the up and down orientation to be lerped i only want this part to get lerped CFrame.lookAt(head.Position, head.Position + ToCFrame) * CFrame.Angles(0, math.rad(-90), 0)
this makes the player face parallel to the wall. and as u see since there is different parts at different angles its snaps to the new angle i want it to be smooth
i was able to reach a similar outcome before but its not exactly what i need. i made a small change so that i can look up and down. as you can see the camera is not in first person anymore since the position is being affected by the lerp i think.
It is though. The slight differences you may see between them are because when you multiply CFrames together, they can cause unintended floating point values.
ik im being too annoying but its almost perfect. Noramlly when i multiply
CFrame.Angles(math.rad(AngleX),0,0)
it allows me to look up and down while wallrunning.
The video above is an example of how it looks like to look up and down. (its smooth and allows and has a limit when looking up or down you cant do a full 360)
this seems to only work and face the correct direction when the wall is on the right side doesn’t work if the wall is on the left it faces the opposite direction the player is moving