[Line of sight] Not working with families

Bugs will be moved here once resolved.

Post » Sun Oct 26, 2014 12:56 pm

Problem Description
When using the LOS and families obstacles are ignored.
I have made an example where there is a player unit and an enemy and a green box working as obstacle with a solid behaviour.

When I use the LOS that is added to the player unit it self, it works fine.
Image
Image
Image

Using the one that is added to the family which uses the exact same settings. It doesn't see the green box as an obstacle.
Image
Image


Description of Capx
Check line of sight between 2 objects, using a LOS added to a specific object and one add to a family.

Observed Result
LOS doesn't work when its a family.

Expected Result
That it would be like any other behaviour that is added to a family and can be used by the children.

Affected Browsers
All

Operating System and Service Pack
Windows 7

Construct 2 Version ID
r185
You do not have the required permissions to view the files attached to this post.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,838

Post » Sun Oct 26, 2014 2:41 pm

Its working as expected.
You would need to either use the family in the condition, rather than the object, or add the behavior to the objects to do what you are expecting.

Otherwise you are just asking if it has los to itself.
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Sun Oct 26, 2014 3:07 pm

Im not sure what you mean? The red object is not the same as the blue object, also using the player object is not the same as using the family object and im testing towards the enemy object. If I add the enemy to its own family and do a Player LOS to Enemy family where player is not part it still doesn't work.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,838

Post » Sun Oct 26, 2014 3:58 pm

But they are in the same family, and the behavior is of the family.
Its just like if you used units has los to enemy, it won't work there either since the enemy is in the units family.

I see why you want to use it that way, but I don't think he will, or can make it work.
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Sun Oct 26, 2014 5:45 pm

I see your point, but all other behaviours work like that, so why it shouldn't for the Line of sight I don't see a reason for.

The way it is now, you have to add a line of sight for each individual type of object or family depending on your design, which will create a lot of copy/paste conditions. I have a hard time believing its suppose to work like that.

But you are correct that in my case I could just remove the enemy from the family, but then its just a matter of time before the problem occurs again, if for some reason I wanted to make a buff system where enemies within line of sight of each other got a buff of some sort. Then I would end up with the same problem as now as the enemies wouldn't be able to be part of the same family.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,838

Post » Sun Oct 26, 2014 6:45 pm

Its about picking.
Oddly enough you can add a variable to the family, and change that family instances variable and pick using that.

+units variable "selected" = 1
-+player has los to enemy, do fo
->else do other fo
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Wed Oct 29, 2014 4:14 pm

It does end up doing a line-of-sight check to itself in this case, and says it has line of sight. That shouldn't happen, so I changed it for the next build so objects never count as having line-of-sight to themselves, which fixes this case.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest