Overlapping true when objects next to each other

Bugs will be moved here once resolved.

Post » Wed Nov 07, 2012 10:55 pm

Overlapping means one object is on top of another. For some reason, when 2 objects are perfectly side by side (such as in a grid), the overlapping condition is true.

I am using the default calculated bounding box for a 32 x 32 sprite, which contains 0's and 32's in the coordinates. I don't expect a 32 x 32 sprite at 0,0 to be overlapping a 32 x 32 sprite at 32,0
B
7
Posts: 24
Reputation: 590

Post » Thu Nov 08, 2012 12:16 am

Try making the collision box 1 pixel smaller then the sprite image.
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Thu Nov 08, 2012 1:22 am

This will work of course, but its hiding an issue, not fixing it.
B
7
Posts: 24
Reputation: 590

Post » Thu Nov 08, 2012 3:14 am

It's not really an issue, as the edges share the same pixel when they touch each other. And besides, some of the games that people make are also relying on this overlapping condition. Hence, just as justifun mentioned just make the collision area smaller or you could actually give buffer spaces using the animation editor to make the sprite height and width larger while keeping the collision area the same so that when you place side be side the buffer space will separate the sprites so that the overlapping conditions would not trigger.
B
7
Posts: 38
Reputation: 683

Post » Thu Nov 08, 2012 2:16 pm

This is currently by design. Firstly, changing it could break an enormous number of projects. Secondly, I think it makes sense: two 32x32 objects perfectly next to each other will have the left object's right edge at X = 32, and the right object's left edge at X = 32. So their borders are at the same position, which means they are overlapping.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Thu Nov 08, 2012 8:30 pm

Ashley, I understand why it's happening, I just think that not only is this majorly confusing, it's not ideal as a default.

I am beyond doubt that changing it would break a whole load of things. It's actually really nice that you can tell if an object is sitting on a platform or not for example without having to sink a detector 1 pixel down, it's just the wording is misleading.

My suggestion is to add something like "strictly overlapping", i.e. use strict inequalities instead of less than or equal. Add a strict option mitigates for the non-strict behaviour of the default overlapping condition. The boundaries only overlap because there is no convenient way of specifying (object width - smallest floating point delta), and had you been writing a game yourself in javascript you would want to use strict inequalities.

p.s. I might add, overlapping at offset is brilliant, a strict version would be sweet.


mcduck2012-11-08 20:32:27
B
7
Posts: 24
Reputation: 590


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests