Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Nav Mesh Problem with SetDestination

$
0
0
Why does this work this pops up ![/Users/user/Desktop/Screen Shot 2017-07-17 at 5.40.34 PM.png][1] public float deathDistance = 0.5f; public float distanceAway; public Transform thisObject; public Transform target; private NavMeshAgent navComponent; void Start() { target = GameObject.FindGameObjectWithTag("Player").transform; navComponent = this.gameObject.GetComponent(); } void Update() { float dist = Vector3.Distance(target.position, transform.position); if(target) { navComponent.SetDestination(target.position); } else { if(target == null) { target = this.gameObject.GetComponent(); } else { target = GameObject.FindGameObjectWithTag("Player").transform; } } if (dist <= deathDistance) { //KILL PLAYER } } [1]: /storage/temp/97864-screen-shot-2017-07-17-at-54034-pm.png

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>