For my game, I want to move my game object in specific direction but it has to travel any number of units.
At present I have following code for deciding direciton.
Vector3 direction = targetPlayer.position - transform.position;
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
Using above code I have correction direction of object. But how to move game object infinitely on same direction founded?
Please give some opinions in this.
↧