- Home /
Enemy Detects Buildings?
Hi Guys,
I have a simple chase script however my setting is a city and there are alot of buildings. The Enemies spawn behind the buildings and most of them seem to make their own way to my player and chase him which is great, however 1 or 2 seem to constantly bump into the buildings and get stuck. How do i get my enemy to detect buildings and somehow chnage their direction? I have been playing around with this:
Blockquote function OnCollisionEnter (collision : Collision) {
if ( collision.gameObject.tag == "Building" ) { print("Hit Build"); transform.eulerAngles = Vector3(0,180,0); } } Blockquote
Answer by DaveA · Mar 16, 2011 at 09:36 PM
Google 'pathfinding' There are some pathfinding scripts on the Unity script wiki that might help you.
Your answer
Follow this Question
Related Questions
Damage on collision with player.. 1 Answer
Player Dies when Collide with enemy 2 Answers
How to access a bool of a specific clone in a collision 1 Answer
Fist Punch Collision 0 Answers
Enemy Collision Wont Work! PLEASE HELP 0 Answers