Mouse Tilt Viewmodel Issue

The problem is that lerp is calculating the intermediate CFrame as something unintended.

Specifically, this line is generating a weird CFrame:

CFrame.new(character.Camera_Part.Position, Vector3.new(pos.X+5,0,pos.Z))

How is the pos variable defined? I don’t think I saw it in there.

Here are potential problems and fixes:

  • The camera is not positioned at character.Camera_Part.Position, so the position and orientation lerp is causing problems. Try adding Camera.CFrame -= Camera.CFrame.Position + character.Camera_Part.Position before doing the camera lerp
  • If that doesn’t fix it, you could try manually removing the camera’s roll:
-- (Use after setting the Camera.CFrame with the lerp)
-- Get roll angle
_, _, az = Camera.CFrame:ToEulerAnglesXYZ()
-- Make CFrame with opposite roll angle
oppositeRoll = CFrame.Angles(0, 0, -az)
-- Apply the opposite roll relatively to the CFrame
Camera.CFrame = Camera.CFrame:ToWorldSpace(oppositeRoll)
1 Like