LOS Raycasting is Behaving Oddly

0 favourites
  • 4 posts
From the Asset Store
AI for enemies in style of a well known blue robot guy.
  • EDIT: I solved my own problem. It was an incorrect reference to an instance variable. (See my last comment below.)

    I'm working on a stealth-styled mini-game and, as expected, the Line Of Sight (LOS) behavior is employed.

    Instead of giving the behavior to the enemy guards (black circles with green+red eyes), I've given them to the red lines you see as in the screenshot below...

    Instead of projecting a single image to show the cone of the LOS field, I'm using individual lines that show how my character, Mr Spy (grey circle, green eyes) falls into that field of vision (the black and grey walls also work the same way).

    The polygon hitbox for Mr Spy is an 8-point "circle" for the sprite...however, even with that shape, the red lines clearly show a massive off-set of hit detection when using the LOS behavior raycasting and detection. Here's the setup at the Start Of Layout as well as the raycasting event lines:

    While this seems to work...it's obviously not working as I hoped. Some lines are going right through Mr Spy while others are acting like they're detecting raycast hit detection when they're (visually) not.

    Any idea why it's behaving this way? What am I missing?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Check collison mesh for your player character maybe?

  • VinniePin - That's a good question. I haven't touched the Collision Mesh; only the Collision Polygon in the image editor.

  • OH MY GOODNESS. I figured it out. I was setting the TargetY variable to Self.StarX and not Self.StartY.

    PROBLEM SOLVED.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)