Unexpected Box Edge Collision

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
kalium
Prole
Posts: 9
Joined: Fri Jul 06, 2012 6:36 pm
Location: Rio de Janeiro

Unexpected Box Edge Collision

Post by kalium »

So here's the deal.
I'm making a small platformer, using tile maps to define the levels, and creating the solid tiles as static physical objects that collide with the player, and everything is fine about that.
Usually, collision works just great. Except when the player reaches the edge between a tile and another. Sometimes he passes through them, sometimes he gets stuck on it, and I can't figure out why.
To try and ease this, I made a small algorithm to scan for adjacent tiles horizontally and create them as a single continuous object, but as far as vertical strips of tiles (Walls) go, they still have the same bug, so I'm here humbly asking for help.
The bug occurs sometimes when you try to jump while pressing onto a vertical wall, you ocasionally get stuck, as if you were touching the ground.
I dunno what is wrong or why this happens, but it's always on the edge between two tiles.

Here's the .love for the game if its any help, and thanks.
game.love
(3.97 MiB) Downloaded 154 times

PS: Feel free to comment on any other aspect of the game if you want.
User avatar
dreadkillz
Party member
Posts: 223
Joined: Sun Mar 04, 2012 2:04 pm
Location: USA

Re: Unexpected Box Edge Collision

Post by dreadkillz »

Didn't check the code, but it may be related to 4.5 EDGE SHAPES: http://www.box2d.org/manual.html#_Toc258082970
User avatar
kalium
Prole
Posts: 9
Joined: Fri Jul 06, 2012 6:36 pm
Location: Rio de Janeiro

Re: Unexpected Box Edge Collision

Post by kalium »

dreadkillz wrote:Didn't check the code, but it may be related to 4.5 EDGE SHAPES: http://www.box2d.org/manual.html#_Toc258082970
And it is!
That's exactly the problem I'm having. And apparently the only way to solve it is by using Chain Shapes to generate the landscape from the tilemaps, it seems.
And that is going to take a much more complicated algorithm than I thought. Anyway, that was exactly what I was looking for, thanks a lot!

Now to figure out a practical way to create the whole landscape in continuous ChainShapes.
Post Reply

Who is online

Users browsing this forum: Google [Bot], pgimeno and 12 guests