Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- transform.position = Vector3.Lerp(transform.position, waypoints[currentWaypoint].position, damping);
- if (transform.position == waypoints[currentWaypoint].position) {
- if ((currentWaypoint < waypoints.Length && direction) || (currentWaypoint > 0 && !direction)) {
- currentWaypoint += direction ? 1 : -1;
- } else {
- direction = !direction;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment