Line of Sight only checking origins, not bounding boxes?

Bugs will be moved here once resolved.

Post » Mon May 12, 2014 7:22 pm

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
ImageImageImage
B
16
S
3
Posts: 45
Reputation: 2,188

Post » Tue May 20, 2014 11:56 am

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.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Thu May 22, 2014 5:34 am

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.
ImageImageImage
B
16
S
3
Posts: 45
Reputation: 2,188

Post » Thu May 22, 2014 9:45 am

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)
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
116
S
40
G
17
Posts: 2,199
Reputation: 19,435

Post » Thu May 22, 2014 3:49 pm

@jayjay Ah, thanks for the example!
ImageImageImage
B
16
S
3
Posts: 45
Reputation: 2,188


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests