Make Gameobject move along ONE axis.

Currently this VVV makes the Enemys move upwards but I want them to move downwards.

using UnityEngine;
using System.Collections;

public class EnemyMovement : MonoBehaviour
{
    public GameObject Enemy;

    void Update ()
    {
        transform.Translate(Enemy.transform.up * Time.deltaTime);
    }
}

-Enemy.transform.up

Is this what you want?

transform.Translate(-Enemy.transform.up * Time.deltaTime);

I want the “enemy” to move DOWNWARDS.

isn’t down the inverse of up?

Which is why the set the Enemy.transform.up to negative. Look more closely.

Ah, thanks forgot that symbol.

1 Like