1
Support / Re: Trying to use Polygon Collider instead Edge Collider with tiles
« on: December 08, 2014, 03:04:35 pm »
The code is actually very simple, the file that need to amend is tk2dTileMapColliderBuilder2D.cs. Take a look at https://gist.github.com/kevdotbadger/fd2216c497495de5980d
Basically the BuildLocalMeshForChunk() method is responsible for making the edge collider, it has a bunch of if statements looking for collider types (spriteData.colliderType == tk2dSpriteDefinition.ColliderType.Box), in that branch is where you want to create the box colliders (instead of, or as well as the edge colliders).
My solution was to create (or empty) a parent game object every time the "commit" button was pressed (this is in the Build() method). Then add a shit load of box colliders into position (making the box colliders a child of the parent object - just to keep my level a little tidier). On line 195 is where the box colliders are made, inside the BuildLocalMeshForChunk() method.
Compare the original tk2dTileMapColliderBuilder2D.cs and my amended one at https://gist.github.com/kevdotbadger/fd2216c497495de5980d to see what's going on.
Basically the BuildLocalMeshForChunk() method is responsible for making the edge collider, it has a bunch of if statements looking for collider types (spriteData.colliderType == tk2dSpriteDefinition.ColliderType.Box), in that branch is where you want to create the box colliders (instead of, or as well as the edge colliders).
My solution was to create (or empty) a parent game object every time the "commit" button was pressed (this is in the Build() method). Then add a shit load of box colliders into position (making the box colliders a child of the parent object - just to keep my level a little tidier). On line 195 is where the box colliders are made, inside the BuildLocalMeshForChunk() method.
Compare the original tk2dTileMapColliderBuilder2D.cs and my amended one at https://gist.github.com/kevdotbadger/fd2216c497495de5980d to see what's going on.