- Home /
Question by
imranyafith · Nov 23, 2018 at 06:08 PM ·
camera followsmoothdamp
SmoothDamp on Y axis is inconsistent.
public PlayerController player;
float movementX;
float movementY;
float movementVelocity;
[SerializeField] float smoothTime = 0.15f;
void Update () {
movementX = Mathf.SmoothDamp
(transform.position.x, player.transform.position.x, ref movementVelocity, smoothTime);
movementY = Mathf.SmoothDamp
(transform.position.y, player.transform.position.y, ref movementVelocity, smoothTime);
}
private void LateUpdate() {
transform.position = new Vector3
(player.transform.position.x, movementY, transform.position.z);
}
Here I have a script that is attached to my Main Camera that is supposed to follow my Player around with a little bit of delay. But whenever I move my Player, the Y position of my camera keeps increasing and decreasing resulting in a kind of wobbly effect. Anyone know why this is happning?
Comment