Detection System

So, I’m trying to set up a detection system for my monsters. I am using a radar sensor to give them an area of vision that reacts to the player. I was thinking I could combine this with the ray sensor so that they could not see through walls, but I haven’t had any luck in finding a way to dynamically point the ray at the detected player to check if there is or is not a wall there.

Any suggestions on how I may be able to set this system up? I’ve only recently started working with Blender and Python, and I’m at a bit of a loss here. Any help would be greatly appreciated.

The rayCast or rayCastTo should help you out. I have not yet played around with them but have a look at http://bgepython.isgreat.org/KX_GameObject.KX_GameObject-class.html#rayCast
If you are not familiar with python I would recommend parenting an empty to the enemy with a ray sensor with apropriate range that tracks to the player.

Thank you! That’s exactly what I was looking for. I just hadn’t found that function listed in any of the places I had been looking. Hopefully that will take care of that issue I was having. :slight_smile: