- Home /
Question by
kollosuss13 · Apr 11, 2020 at 09:27 AM ·
camerajittering
[HELP] How to fix camera jittering?
Hello, i have a problem with camera jittering. I'm using smooth damp to camera follow the player with interpolating rigidbody, but i have a little jitter 1 time per 5 second. script below. Please help.
public Transform Player;
public Vector3 offset;
public Vector3 offset2;
public float duration;
private Vector3 velocity = Vector3.zero;
private ScaleManipulation scaleManipulation;
// Update is called once per frame
void LateUpdate()
{
scaleManipulation = FindObjectOfType<ScaleManipulation>();
if (scaleManipulation.UseSkill)
{
SmoothFollow(offset2);
//transform.position = Player.transform.position + offset2;
}
else if (!scaleManipulation.UseSkill)
{
SmoothFollow(offset);
//transform.position = Player.transform.position + offset;
}
}
void SmoothFollow(Vector3 _offset)
{
Vector3 desiredPosition = Player.transform.position + _offset;
Vector3 smoothedPos = Vector3.SmoothDamp(transform.position, desiredPosition, ref velocity, duration * Time.deltaTime);
transform.position = smoothedPos;
}
Comment
Your answer
Follow this Question
Related Questions
Camera doesn't render sprites properly on 2D game 0 Answers
My Cinemachine Freelook camera is jittering 1 Answer
Camera following two objects 0 Answers
How to make camera position relative to a specific target. 1 Answer
Weird Glitching With Camera 0 Answers