I have got it running the way I want but the transition between player and camera movement are off the player is bouncing backwards when hitting the transition point. Can someone go over how I can resolve this issue or point me in the right direction please?
It is a 2d game and I would like the movement like that of the original Super Mario Bros.
I have tried several things like changing the offset value, giving the camera a speed value and a few other things I could think of trying but nothing seems to work properly.
[SerializeField] GameObject player;
[SerializeField] float offset = 8.0f;
private void Update()
{
if (player.transform.position.x >= offset)
{
Vector3 cameraPos = new Vector3(transform.position.x + 1,
transform.position.y,
transform.position.z);
transform.position = cameraPos;
offset = offset + 1;
}
}