Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
TileMap to Box2D - Gideros Forum

TileMap to Box2D

totebototebo Member
edited December 2017 in General questions
I'm trying to work out a good way to convert platforms imported from Tiled to collision fixtures in Box2D. The lazy option is to make a square fixture for each tile. This would be quite inefficient. @hgy29 had a great suggestion:

"Make a two tables of all tile edges: one for horizontal edges and the other for vertical ones. Then go through your wall tiles and increment the correct locations in your two arrays for the four edges of your tiles. In the end you'll get odd numbers for outlines and even numbers for edges not part of the outline"

This would work in most cases, but not in some, like the example below.

image

Box2D doesn't seem to allow the below boxes as one shape, because the vertices in between the two shapes have no width/height.

Do you have an idea of how to solve this?
My Gideros games: www.totebo.com
tiles to box2d.png
1121 x 330 - 34K

Comments

Sign In or Register to comment.