Search Unity

Make 2d Game Object retract to another Game Object with a condition

Discussion in '2D' started by Bologi, Aug 5, 2019.

  1. Bologi

    Bologi

    Joined:
    May 17, 2018
    Posts:
    4
    Hi. I am making a 2D game that involves shooting a game object to a certain position. There are 2 connected game objects and one of them will be shot to a certain point. I managed to get it shooting correctly but the problem is I want that when the game object reaches that point, the other connected game object will slowly move towards it maintaining a certain distance between them. I don't know how to go about this........
     
  2. Nyfirex

    Nyfirex

    Joined:
    Jun 26, 2019
    Posts:
    22
    I think you could use a trigger. Put the trigger in your "certain point" then when the object 1 enters the trigger call the function that will move the object 2. You can find many scripts online on how to move towards a certain point