Rotating enemy with direction

Hello, I am making tower defense game and I want to rotate the enemy with the direction where it’s going because the enemy move forward but the body is backward, and this is my script:

using UnityEngine;
using UnityEngine.UI;

public class Enemy : MonoBehaviour
{
    public float startSpeed = 10f;
    public int startHealth = 100;
    private float health;

    private float speed;

    public int worth = 15;

    private Transform target;
    private int wavePointIndex = 0;

    [Header("Unity Stuff")]
    public Image healthBar;

    public bool isDead = false;

    void Start()
    {
        speed = startSpeed;
        health = startHealth;

        target = Waypoints.points[0];
    }

    public void TakeDamage(int amount)
    {
        health -= amount;

        healthBar.fillAmount = health / startHealth;

        if (health <= 0f && !isDead)
        {
            Die();
        }
    }

    void Die()
    {
        isDead = true;

        PlayerStats.Money += worth;
        WaveSpawner.enemiesAlive--;
        Destroy(gameObject);
    }

    void Update()
    {
        Vector3 dir = target.position - transform.position;
        transform.Translate(dir.normalized * speed * Time.deltaTime, Space.World);
        
        

        if (Vector3.Distance(transform.position, target.position) <= 0.4f)
        {
            GetNextWayPoint();
        }
    }

    void GetNextWayPoint()
    {
        if (wavePointIndex >= Waypoints.points.Length - 1)
        {
            EndPath();
            return;
        }

        wavePointIndex++;
        target = Waypoints.points[wavePointIndex];
        
    }

    void EndPath()
    {
        PlayerStats.Lives--;
        WaveSpawner.enemiesAlive--;
        Destroy(gameObject);
    }

}

and if you know how can I rotate the body with the direction please answer me.

If your enemy is always facing backwards, as in it looks like they are walking backwards every direction they move, then you can just rotate them manually 180 degrees in the scene editor or their prefab wherever it is.


If you are saying they never rotate at all, then you can try using this

transform.LookAt(target);

If this seems to sort of work but it’s always at an angle you might need to set its up direction like this:

transform.LookAt(target, Vector3.up);

You might find its a different direction to Vector.up depending on your setup.