|
/this must be applied to the AI with a NavMeshAgent/ private var NavComponent : NavMeshAgent; var Target : Transform; function Update () { var hit : RaycastHit; //GetComponent().destination = m_player.position;//follow c# version NavComponent = this.transform.GetComponent(NavMeshAgent); var up = transform.TransformDirection(Vector3.forward); if(Physics.Raycast(transform.position, -up, hit, 10)){//anything that gets hit including terrain Debug.Log("Hit"); } }
(comments are locked)
|

ok i fixed the problem by replacing it with NavComponent.destination = Target.position;