this time I am stuck with Raycasting - I’ve found this example:
but I cant replicate this condition as it seems it doesnt exist anymore?? and without it even the sample game doesnt work.

anyone knows how I fix / replace that logic so it works?
here is my logic:
here is the logic from that example that works:
thanks!
I think if you use the number of instances picked condition instead of living on scene that it should work. One counts all of the instances and the other only the currently picked objects.
It took me a bit to understand the logic. It uses a group list of walls and a player it then detects the closest object in the set direction and range. If the closest object is a tank then there’s no wall in front of the tank. Nice.
1 Like
Thanks @Keith_1357 !
Tried this one, didn’t work
My issue is that the guards seem to ignore the CastlePlan_Walls and the distance as well… and they just come right at me, where they should not be able to “see” through the Objects in the CastlePlan_Walls object group.
In the example game it works well, but when I remove that one condition I mentioned before, the tanks come at the player immediately ignoring the walls too… so Im thinking because that condition doesn’t seem to be available anymore, what’s in the example just doesn’t work anymore.
My main question is - how do I create logic where guards chase the player, but only if they have a direct line of sight with no objects between them and the player; so if they see the player they go to the last visible to them location of the player and then if there is no visual contact with the player at that location, they wait X amount of time, and then return to their original position.
Do you know a way of doing it?
When I changed the condition in the project that you linked to, it seemed to work for me.
Do you have multiple spy objects? Are you starting the timers somewhere else? Just asking.
Is the angle formula correct? You could try to draw a circle or line where the formula is point towards. It can help by visualizing the raycast.
Another option is to cast a ray targeting obstacles between the player and enemy or whatever your characters are called. That approach might need to be in a NOT or maybe flip the variable value or check. IDK.
Let me do some testing.
1 Like
I tested it like this. It seems to work. I had 1 player and several guards. It would need work if you have multiple spies or in my case players. The OBJs group contains both the player and the wall object.
Edit:
I think your objects are reversed compared to the example project.
I think the number of picked objects condition should be for the spy. There will always be 1 guard picked because of the for each guard and the fact the ray starts inside of a guard.
1 Like
oh man this finally worked!! I followed your exact set up and it works like magic, including your angle formula!!! 
thanks so much, it feels so good to have it solved!!!
I can finally move on with the other features!! :))))
2 Likes