Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Update()
- {
- if(flagJourney == false)
- {
- endPosition = P1;
- startMarker = transform;
- startTime = Time.time;
- flagJourney = true;
- }
- else
- {
- float prec = (Time.time - startTime) / (0.1f);
- if(prec >= 1)
- {
- flagJourney = false;
- if(prec > 1)
- prec = 1;
- }
- transform.position = Vector3.Lerp(startMarker.position, endPosition, prec);
- Debug.Log(Vector3.Distance(transform.position, endPosition)); // вывод дистанции, которую проходит объект за 1 проход
- }
- }
Add Comment
Please, Sign In to add comment