Forum rules - please read before posting.

View Not through walls

Hi,

Check "this image" to understand my question clearly.

Player (Green Circle) is hiding in a room(it's top down view). Cop (Black Circle) is in another room. I have attached a Cop's View(Blue sprite) to the cop as it's child, so it follow as the cop moves in the room. When the player is overlapped with the blue sprite, I want to set that the cop has seen the player. 

Question1: Creating a trigger and adding that trigger as a child for cop. is this a good idea? 

Question2: BUT the Walls (Red Lines) are in-between, so the cop actually didn't see the player. How can I solve this AI. ?

Thanks a lot in advance

Comments

  • You'll need some additional scripting for this.  While you could make use of an AC Trigger for this, you'll be better off making your own trigger script as you'll also need to check for the "sight line" you bring up in question 2.  Basically you want the following two things to be checked for, before the cop detects the player:

    1) The player is within the boundaries of the blue portion
    2) There is no wall collider in between the cop and the player

    2) Would require a script that performs a raycast between the two characters.  As this is not an AC-related question, you will have to look to Unity's scripting guide or the Unity forum for further help on it, but it's a standard problem when making stealth games and help shouldn't be hard to find.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.