'Unity FPS Controller camera only moves when mouse movement stops
Using unity FPSController asset, here's the code for actually moving the camera called in LateUpdate()
method.
private void CameraRotation()
{
// if there is an input
if (_input.look.sqrMagnitude >= _threshold)
{
//Don't multiply mouse input by Time.deltaTime
float deltaTimeMultiplier = IsCurrentDeviceMouse ? 1.0f : Time.deltaTime;
_cinemachineTargetPitch += _input.look.y * RotationSpeed * deltaTimeMultiplier;
_rotationVelocity = _input.look.x * RotationSpeed * deltaTimeMultiplier;
// clamp our pitch rotation
_cinemachineTargetPitch = ClampAngle(_cinemachineTargetPitch, BottomClamp, TopClamp);
// Update Cinemachine camera target pitch
CinemachineCameraTarget.transform.localRotation = Quaternion.Euler(_cinemachineTargetPitch, 0.0f, 0.0f);
// rotate the player left and right
transform.Rotate(Vector3.up * _rotationVelocity);
}
}
At first, I thought I was just having FPS issues, but the game is completely smooth when the camera is not moving, as soon as movement starts, the camera is extremely jittery. further testing it feels like the camera only moves when I stop moving my mouse. Like it knows where it should be but doesn't get there smoothly, just gets there when you're done inputting your movement. I've tried lowering the rotation speed variable to make sure its not a sensitivity thing. Same problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|