Combining radar and ray sensors

Hi,

I’m currently building a first person game but I cant seem to prevent my radar from ‘seeing’ through walls in my arena, ive read that this can be stopped by combining my radar with a ray sensor but im really struggling. Does anyone know how to do this??

Thanks,

Lewis

[video]http://m.youtube.com/watch?v=zW5_BvmOwvw[/video]


import bge
cont = bge.logic.getCurrentController()

own=cont.owner

Radar=cont.sensors['Radar']

if sens.positive:
   Ray=own.rayCastTo(Radar.hitObject,0,'property')
   if Ray!=None:
       Ray can see enemy

might still need some work

Attachments

DemoRadarRay.blend (461 KB)

Using a brick should be okay?

So if Ray or Radar And Steering so object can move to player once the player is close by.

A post was split to a new topic: Make them invisible and make appear when they detected

I tried both Ray and Radar for one object but nothing happens with an Always and steering bricks, on the other AI object it began spinning once I used a Radar even though it wasn’t connected to the motion brick.

Or it doesn’t work as they are? I’m sure those bricks work as they do, I must of used in my LIS files once. I mainly used collision or Always, Always was the standard for a steering brick.

In that example, it uses one property. In the file I use, the player is a Boolean, so another player isn’t necessary as a float.

I’m not sure what should be happening the file I am editing.