Hello Guest

Author Topic: Top-down Tilemap colliders  (Read 4087 times)

mossflower

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Top-down Tilemap colliders
« on: September 21, 2013, 11:29:44 pm »
Hello,

We recently started working on a 2D top-down game using the 2D Toolkit, but we're having some trouble setting up the colliders that go with the tilemap. To make it top-down, we've rotated the tile-map 90 degrees around the x-axis, as well as the tk2d camera. We then set the collider type for each of the sprites to box trimmed, and set the collider depth to 20. When we run the game with a cube that has a rigid-body, though, it doesn't detect the collisions (the cube falls through the tile-map). It kind of seems like mesh colliders are rotated incorrectly. So i f we go in and replace the mesh collider for the tile map render data with a box collider, however, it suddenly works. It seems like manually going in and replacing the mesh collider like this is bad. Is there a better way to do this?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Top-down Tilemap colliders
« Reply #1 on: September 22, 2013, 11:28:16 am »
The tilemap doesn't have front and/or back caps on by default. This is by design, as since your tilemap is all at the same position on the ground, there is no need for vertical movement. While you can turn it on, I don't think there is any reason to do it - Just turn off gravity and it won't fall through, but will collide with the walls - which I'm guessing is the behaviour you want. Also, if you want sliding, etc with the tilemap walls, then look at this example using the character controller.
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,2476.0.msg12395.html#msg12395

mossflower

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Top-down Tilemap colliders
« Reply #2 on: September 22, 2013, 05:25:00 pm »
This makes sense. Thanks!