Would really appreciate any help on this as I have been trying all day.
The image is moving automatically and the camera follow it as a child, but the camera also follows whenever the image moves left or right. When the player moves, I would like for the camera to stay still, but still following them where they are automatically moving.
float distance = 10f;
float speed = 0.1f;
Vector3 direction = new Vector3(1f, 0f, 0f).normalized;
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
transform.Translate(direction * -distance);
}
else if (Input.GetKeyDown(KeyCode.RightArrow))
{
transform.Translate(direction * distance);
}
transform.Translate(0F, 13F, 0 * Time.deltaTime);
}
Thanks for any help