Hello everyone,

I know how calculate a distance beetween the object and the player but i dont know how teleport an object three quarters of its distance with the day after a certain time, then with the half, then with the quarter … Can you please help?

Thanks in advance.

So assume you have X and Y coordinates.

Player has coordinates (pX, pY).

Object has coordinates (oX, oY).

The distance between them is sqrt((pX-oX)^2 + (pY-oY)^2) (sqrt means square root)

To move an object somewhere, you have to calculate what his new position will be. If you want to move him by a quarter, then calculate his new position:

newX = pX +(pX-oX)/4; and newY = oY + (pY-oY)/4;

And move the object there (access his transform component and change the x and y values).

However be careful - if you use the same formula to calculate how much closer to move the object, then the second time you use it it will move him by a quarter of the new distance, not the old. If you want those increments to stay consistent, you have to make a new variable and assign the increment ‘size’ by which it will have to change the object’s position every time.

Do you know what is the problem ?