Radar question..........

Ok I have bee using radars but i have i one problem… they act as x rays… I need my player to be able to see the enemy and not if it is behind a wall, but radars see it through the wall.

You can check if an object is within another object’s line-of-sight by casting a ray from one to the other. If the ray hits, the objects can see each other.

In your case, you’ll need to cast a ray to every object in the radar sensor’s hitObjectList. Depending on your needs, it may end up being more efficient to just use ray casts exclusively instead of using a radar sensor

enemies_in_radar = player.sensors["Radar"].hitObjectList
enemies_visible = []
for enemy in enemies_in_radar:
    if player.rayCastTo(enemy) == enemy:

the method do a ray where the start of ray is the position of the obj caller(implicit)
and the end is the first argument of the function(gameobject or vector)
and return the first obj that the ray hit. (so can return the wall obj , or None)

if the actors uses simple shape(box,sphere etc) the radar is not so heavy…

I have found if your going to have many Ai,

have only the steering logic, and attack logic in the actor,
and have a script cast rays, and give orders for ALL ai.

this way you can run swarms without a bogdown.