Hello
I’m trying to make a little isometric game of a car.
The problem is that when making the road with an isometric Tilemap the movement of the car is not aligned with the street.
By pressing “W” + “D” for example you should follow the street in a straight line.
But what happens is that the car goes straight to the edge of the street and crashes …
The question is: How can I align the movement of the car with the Tilemap?
I share the movement script:
private Vector2 movimiento;
private Rigidbody2D rb;
private float Aceleracion = 0;
public float Velocidad;
public Animator animator;
void Update()
{
movimiento.x = Input.GetAxisRaw("Horizontal");
movimiento.y = Input.GetAxisRaw("Vertical");
animator.SetFloat("Horizontal", movimiento.x);
animator.SetFloat("Vertical", movimiento.y);
}
private void FixedUpdate()
{
if (Aceleracion < 10 && (movimiento.x != 0 | movimiento.y != 0)) Aceleracion = Aceleracion + 0.11f;
else if (Aceleracion > 0) Aceleracion = Aceleracion - 1f;
rb.AddForce(new Vector2((movimiento.x) * (Aceleracion + Velocidad), (movimiento.y) * (Aceleracion + Velocidad)));
Debug.Log("X:" + movimiento.x);
Debug.Log("Y:" + movimiento.y);
}
Thanks for the help!