- Home /
I have an NPC that follows the player around. I want it to keep track and update 'Cover Positions' if things get bad.
I am walking through a village all of the buildings have mesh colliers on them. I want my NPC to create an array of all the different buildings within a 10 by 10 unit box around the NPC to flee to.
I tried using indie{RAIN} but felt restricted by it so I decided to create my own sensor. I started with a trigger box collider and simple script to detect collisions:
void OnCollissionEnter(Collision other){
if(other.transform.tag == "building"){
Debug.Log (other.gameObject.name);
}
}
this however does not detect collisions. I was wondering if anyone had tried to do something like this and how they achieved it( ideas not actual working game object or code). I want to figure this out on my own I just want an idea of where to go. Also please no RAIN stuff, already tried didn't like.
thanks again
Answer by meat5000 · Sep 23, 2013 at 05:33 PM
Use OnTriggerEnter instead. Make sure to mark the trigger box on the collider.
Your answer

Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Swapping 2 objects positions when one is dragged into the other 1 Answer
"Mass place trees" vs -place trees with brush- vs -my own script- 0 Answers
Using different paricle emitters depending on the tag of the object raycast hits? 1 Answer