Is Line of Sight behavior supposed to onl intersect with image points and not collision polygons?

0 favourites
  • 3 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Howdy partners,

    I was curious if it was intended for LOS behavior to only scan for image points rather than collision shapes.

    drive.google.com/file/d/1_M6Ti-S8A_pE9qQzDJLVTh-KkJH1h_-7/view

    I modified the example los project to demonstrate what I mean. The green line shows where a raycast is hitting a piggy, while the highlighted piggy is intersecting with los cone (set to 1 degree atm).

    You can see that while the ray intersects with the collision shape, the los cone seems to only scan for image points. I assume this is intended, but it does allow rather large objects to "hide" simply by keeping the image point hidden.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'd assume the los behavior shoots raycasts at all imagepoints to attempt to make sure that even if a small part of the object peeks out, it triggers the los. With such a small cone you'll shoot through these objects if it doesn't happen to hit an imagepoint + I think the objects being a obstacle themselves will potentially obscure image points on the backside that otherwise would trigger the los.

    Meaning small gaps can also fail to register los even if you set the cone bigger if no imagepoint happens to be visible behind the gap.

    I guess the way to mitigate that would be to cast a bunch of raycasts along the lines defined by the image points, rather than only the imagepoints themselves, with the tradeoff being that it's more expensive to do. Although I've been told raycasts are super cheap. OR you increase the amount of imagepoints but I don't think that's the smart way.

  • LOS only casts a single ray to the given position. If you test LOS to an object it only checks the object origin position.

    Testing if the whole shape or any part of the shape has LOS is tricky - you have to cast multiple rays across the object to check if any part of it is visible; for a 100% accurate version you'd need to cast an extremely high number of rays which would kill performance; and for high performance you need to cast as few rays as possible, which means certain size gaps or overhangs will not be counted as visible even though they would be with a 100% accurate system. So there is a performance/accuracy tradeoff there. The LOS behavior gives you the single ray primitive so you can build your own logic that makes your own tradeoff about how to detect larger objects. One simple scheme is to add a few image points around the edges of the object and check if there is LOS to any of those. There will still be edge cases where the object is not counted as visible when it is though.

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