Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How can I move an object from one point to another?

Discussion in 'Project Tiny' started by nimauke, Apr 29, 2019.

  1. nimauke

    nimauke

    Joined:
    May 18, 2018
    Posts:
    7
    Hello,
    I have 3 points: point A, point B and point C.
    How can I make an object move from point A to point B, then from point B to point C and then back to point A?
     
  2. Pakor

    Pakor

    Joined:
    Feb 2, 2017
    Posts:
    32
    You should probably make an array with Vector2/3 points. These are the points that you want your object to move to and from. After that you should make a system that checks at which point your object currently is, and moves to the next point in the array by using either a slerp function, a move towards function, or anything alike. Once it reaches the next point, you set the point to move to to the next point in the array. When it has reached the last point, you can just tell it to move to the first one again.
     
    boringName and reallyhexln like this.
  3. nimauke

    nimauke

    Joined:
    May 18, 2018
    Posts:
    7
    I ended up using tweening, but thank you for your answer!