Line of Sight only checking origins, not bounding boxes?

0 favourites
  • 5 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Problem Description

    Line of sight seems only to take object origin into consideration and not object bounding box. Therefore line of sight checks do not work very well with a narrow scope.

    I'm trying to build a laser with a very narrow scope for a schmup and LOS would work great if not for lack of bounding box checks.

    If this is the intended behavior, it's somewhat counter-intuitive.

    Attach a Capx

    Here's the .capx

    Description of Capx

    The capx has test boxes for which the laser should size according to the wall it has hit, otherwise reach the top of the screen. You can control the player position with arrow keys.

    The origin point for these walls is in the bottom right corner of each instance.

    Steps to Reproduce Bug

    • Use arrow keys to move the laser about
    • Notice how the laser only reacts when in line of sight of the origin point (shooting the bottom right corner of any given wall)

    Observed Result

    The laser shoots through walls even though they are blocking line of sight, unless shooting directly at the origin point.

    Expected Result

    The walls should block the laser at any point of the wall.

    Affected Browsers

    ALL

    Operating System and Service Pack

    Window 8.1 Pro, 64-bit

    Construct 2 Version ID

    beta r169

  • This is currently by design, not a bug. You can work around it by using multiple line of sight tests, but this multiplies up the CPU usage necessary for LOS to work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, thanks for the follow up. I think we found an easier way of doing it in the end, but this will be good for reference in the future.

  • If you ever need another way of doing LOS checks you can also use this method: https://dl.dropboxusercontent.com/u/471 ... omLOS.capx

    It's designed for use with a single player object being tracked by enemies, and you can change the height of the LOS objects to 1 if you want it to behave like laser beams (the reason why it matches width of enemy object is so that enemies can walk through the space they see player at)

  • Jayjay Ah, thanks for the example!

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