- Home /
light sound sensitive AI
I want my character to only be able to see my character in light. I also want it to react to light by finding the light source and if it hears a noise it will search for the source. I have no idea where to begin with this can someone help me.
Answer by ConfinedDarkness · Sep 22, 2011 at 12:26 PM
Well a start with seeing in the light is this:
if(Vector3.Distance(transform.position, light.position) - light.range >= 0) {
LookForCharacter();
}
With the sound:
for(var sounds in FindObjectsOfType(AudioSource)) {
if(Vector3.Distance(transform.position, sounds.position) - sounds.maxRange >= 0) {
SetWayPoint();
}
}
Any questions, please ask!
also i want it to look for the light source do you know any way i could do that
Your answer
Follow this Question
Related Questions
Object visible in one specific light 0 Answers
Enemy sound detection 5 Answers
Use of an AI script, and having it NOT go through walls using a character controller 0 Answers
enemy waypoints and detection scipting 2 Answers
AI detection script problem 0 Answers