platform sprite, bad collision detection

Bugs will be moved here once resolved.

Post » Thu Nov 17, 2011 7:27 am

Currently using r68 64-bit, on Windows 7, running game in Chrome. Although this problem was happening on previous releases as far as I know.

Using nothing but the platform behaviour and solid sprites as a bare bones platform environment seems to result in tiny errors in the collision detection.

I'm not entirely sure how to best describe it, so here's a screenshot.



As you can see, the player sprite is inside the floor by a pixel or so, and about a pixel away from the wall, even though it should be touching the wall.

As the player moves around, it seems to be random as to when it falls into the solids like this. You can jump up and down on the spot, and each time you land it could be either sitting perfectly on top of the solid, or sitting inside it by a pixel or so.

Does this happen for anyone else?

capx

edit: FYI, it happens in Canvas2D and in WebGL, with Point or linear scaling and in crop or scale mode.plauk2011-11-17 07:30:41
B
28
S
7
G
7
Posts: 102
Reputation: 6,483

Post » Thu Nov 17, 2011 7:47 am

Might try pixel rounding.
That "snaps" the object to it nearest whole number, and gets rid of the decimals, IE x=1, not 1.5newt2011-11-17 07:47:46
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Thu Nov 17, 2011 7:50 am

I tried pixel rounding, and the problem persists. Just checked it again to be sure... no luck.
B
28
S
7
G
7
Posts: 102
Reputation: 6,483

Post » Thu Nov 17, 2011 11:50 am

I think the speed of the platfor behavior is set too high and it doesn't detect solids properly, If you try divide all values in the platform properties by 10, it works normally.
edit>pixel rounding works for me
Noga2011-11-17 11:55:23
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Thu Nov 17, 2011 11:57 am

[QUOTE=Noga] I think the speed of the platfor behavior is set too high and it doesn't detect solids properly, If you try divide all values in the platform properties by 10, it works normally.
edit>pixel rounding works for me
[/QUOTE]

This doesn't work for me. I've now got it set ridiculously low... like moon gravity low... and it still does it.

edit: Pixel rounding definitely reduces the problem, but doesn't eliminate it entirely. Plus it causes jittery movement, so it's hardly a satisfying work around. :(plauk2011-11-17 11:59:46
B
28
S
7
G
7
Posts: 102
Reputation: 6,483

Post » Thu Nov 17, 2011 12:01 pm

I didn't notice it's set on the default values, so it should work and if not, rounding should. Have you tried different browsers?
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Thu Nov 17, 2011 12:33 pm

Same thing happens here and in the platformer examples so er..I think it's just unfinished?
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Thu Nov 17, 2011 2:34 pm

I don't think there's much that can be done about this, by design the platform works to the nearest pixel only. Because you've zoomed in a long way and C2 supports floating point positions, sometimes you see a very thin gap which is less than a pixel thick.

I might be able to revise the code but I had expected results like this. A common workaround is to move the collision box in a little bit.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Thu Nov 17, 2011 7:18 pm

This didn't happen in CC though :< I understand they're different engines but the current one does seem a little wonky.

It also doesn't work very well with moving platforms; the player's Y position doesn't keep up vertical ones, and if you move against a horizontal one the player moves upwards and sometimes ends up on the top of the platform.

Also the "push-out" mechanic seems to only work to some extent. If the player gets smashed by a moving platform and he's near the edge, he'll be pushed out, but if he's near the middle of the platform he'll get stuck. Not a big deal, really, but I thought I should mention it.

Can atleast the moving platform problems be looked into?Tokinsom2011-11-17 20:40:41
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Fri Nov 18, 2011 12:16 am

Can you post bug reports with examples? I had it working fine a couple of months ago, but due to some other reports I had to tweak it a bit so I probably accidentally broke it.

If you get crushed by a block in C2 getting stuck is by design. CC would *always* try to push you out, and that sometimes meant the player teleporting a long way through a thick wall which could ruin games, so now there's a maximum push-out distance before it gives up and leaves you stuck. I'm not sure what else should happen if the player gets crushed by a solid!
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Next

Return to Closed bugs

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests