Answer the question
In order to leave comments, you need to log in
How to make it so that the camera does NOT follow the player along the axis up and down (only left and right)?
Here is the code in case you need it:
public class camera : MonoBehaviour
{
float speed = 3f;
public Transform target;
void Start()
{
transform.position = new Vector3(target.transform.position.x, target.transform.position.y, transform.position.z);
}
void Update()
{
Vector3 position = target.position;
position.z = transform.position.z;
transform.position = Vector3.Lerp(transform.position, position, speed * Time.deltaTime);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question