I just finished the line of sight detection for a stealth game I'm working on. The characters sight field is made of two rectangles and a circle. The rectangles subtract from the circle making a cone shape. These are children of the character so they follow him and his rotation. I have a script that re sizes and rotates every thing based on the size and angle of sight you want so it is easy to change the shape of the line of sight cone. When it detects something of interest is in the cone it line cast to see if it is in view.
This was my first time doing something like this so I thought I would share to show it off and get some feedback. In this gif a green line is drawn every time the guard can see the player.
This was my first time doing something like this so I thought I would share to show it off and get some feedback. In this gif a green line is drawn every time the guard can see the player.
Comments
Post a Comment