Question by
onratak · Mar 18, 2016 at 12:46 PM ·
transform.positionspeedmove
İ want my object move to target object Within 3 seconds how to make it ?
public Transform target;
public float speed; // speed=1
public GameObject my_obje;
void Start () {
float step = speed * Time.deltaTime;
my_obje.transform.position = Vector3.MoveTowards (transform.position, target.position, step);
}
how i do move object within 3 second. My english is very bad :) sory. Thank you for answer..
Comment
you have to detect the Distance between player & target & increase or decrease speed according to that see Vector2.Distance unity doc
Your answer
Follow this Question
Related Questions
How could I make an object move from left to right and it will come back from right? 0 Answers
How can i make an object (a cube) change the surface or plan of the game? 2 Answers
Moving UI buttons with code 0 Answers
Speed exceeds the clamped value by 0.3? 1 Answer
Player resets to previous position or 0,0,0 only sometimes 0 Answers