I have seen many other threads pertaining to this issue ,but the answer doesn’t seem to be working for me. Also, I’m using a mouse to make my player travel towards the mouse. How do I make it so that it is always looking in the direction of the motion. Here is my code for the mouse motion.
private Vector3 mousePosition;
public float moveSpeed = 0.1f;
void Start () {
Screen.showCursor = false;
}
void Update () {
if (Input.GetMouseButton(0)) {
mousePosition = Input.mousePosition;
mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
transform.position = Vector2.Lerp(transform.position, mousePosition, moveSpeed);
}
}