Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IEnumerator MoveRandomPos()
- {
- yield return new WaitForSeconds(Random.Range(4f, 7f));
- StartCoroutine(MoveRandomPos());
- RaycastHit hit;
- Ray ray = new Ray(transform.position, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f) * transform.forward);
- /*Debug.DrawRay(transform.position, ray.direction, Color.red, 3f);*/
- if (Physics.Raycast(ray, out hit))
- {
- if (hit.distance > 2f)
- {
- nav.SetDestination(ray.direction);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement