Move Player to Exact Vector3 Coordinates - beginner question

  1. I want to start a NON PLAYER object that is not triggered by user input at a certain location.
  2. Then I want that NON PLAYER object to move to a specific xyz location once the player begins to play.
  3. I want to use C#
  4. I’ve watched many YouTube videos and read through a lot and tried a lot, but I can’t seem to figure out how to do this. I’ve tried moveTowards and studied Lerp. I don’t think I need Lerp for this.

Please either tell me where to find a really good tutorial (the one in Unity is not really good) or write the code for me and place some fake xyz coordinates where they belong. I need this kindergarten level. Really simple.

Thanks for any help.

It really depends on whether you want the object to snap to a new position or move over time.

For snapping:

public Transform target;

void Start()
{
  transform.position = target.position;
}

If you want to move the object over time. Vector3.MoveTowards will probably do.
This code is taken from the Unity Scripting API which has lots of useful examples on how to use the functions.

    public Transform target;
    public float speed;
    void Update() {
        float step = speed * Time.deltaTime;
        transform.position = Vector3.MoveTowards(transform.position, target.position, step);
    }

Depending on what you want you’ll need to attach a similar script to the object you want to move. When the player starts the game the object will move.

Reference:

Yes, I saw that already, but where do I put in the actual position numbers? I want the object to end up at -265.8, 18.7, -138.6

Do I have to declare a variable? Where do I put those numbers to make sure that the final resting point is exact?

Thanks for answering.