Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var targetOffsetDirection = (transform.position - target.position).normalized;
- var idealPosition = target.position + targetOffsetDirection * safeDistance;
- var directMoveDirection = (idealPosition - transform.position).normalized;
- var perpendicularMoveDirection = new Vector3(-directMoveDirection.z, 0, directMoveDirection.x);
- var zigzag = Mathf.PingPong(Time.time, 2) - 1;
- var moveDirection = directMoveDirection + perpendicularMoveDirection * zigzagFactor;
Advertisement
Add Comment
Please, Sign In to add comment