Problem With Radar

(shotforce) #1

Hello im having a problem with my radar,

well, theres an Enemy and the Player:

ENEMY has an empty with a radar sensor(Radar Looks for Property Player), and when the radar hits the Player The enemy attacks it ,

The problem here its, that when the Player rotates Left Or Right ,

SOMETIMES, The radar Dosnt Work :S

(shotforce) #2

Guys i found it out after making a blend file and alot of testing ;D , for thouse who have this same proble, the problem was, that my player and enemy where on convex hull , it looks like that made it work incorrectly :wink:

(The Minuse L) #3

that discussion is old but i have same problem and how to fix it you can tell me ?

(- Click for resources) #4

the problem was, that my player and enemy where on convex hull

so use something else then convex hull collision bounds, like box or capsule.

(BluePrintRandom) #5
#this is what I use 
for e_actor in enemyList:
    for f_actor in friendlyList:
        local = e_actor.worldOrientation.inverted() * ( f_actor.worldPosition - e_actor.worldPosition)
        if local.magnitude< e_actor['Range']:
            if local.x>0:
                if abs(local.y) - local.x <0 and abs(local.z) - local.x <0:
                     #Friendly is in enemy radar area

Radar sensor is vs every item in that collision layer

(The Minuse L) #6

my enemy collision bound is box and my player collision bound is cylinder my enemy stops sometimes when im not watching him. and continues when I look my enemy.

i think its a optimization problem. radars/rays/nears does not work when
camera could see.

(- Click for resources) #7

That is possible, something stops when not rendered or to far offscreen indeed.
what is it you exactly try to do?

Or maybe try @BluePrintRandom solution, python in this case would work better.

(BluePrintRandom) #8

simple_ai.blend (532.9 KB)

(The Minuse L) #9

i fixed it i just uncheck Occlusion Culling.