Hello Guest

Author Topic: Tilemaps coliders  (Read 5291 times)

godfader

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Tilemaps coliders
« on: January 23, 2014, 05:50:25 pm »
Hi, Im trying to make a 2d top down rpg (pokemon, ff1-6). I used 2dtk to make the tilemap but now i'm stuck on the coliders/colision front. I can't use boxcoliders because of z axis doesnt match. in 2dtk how do i add colliders to make the borders obstacles? like the collision layer in tiledmap.org. Thanks

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemaps coliders
« Reply #1 on: January 24, 2014, 11:37:22 am »
Why does the z axis matter here? If you create box / poly colliders, tk2d will merge appropriately. Eg. in the tile map example in tk2d - the edges are merged to form a silhouette. I guess that would work for your rpg?

godfader

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Tilemaps coliders
« Reply #2 on: January 24, 2014, 12:33:21 pm »
It should, I thought that too, but I added a box collider 2d to the character sprite and to a a building on the sprite map. But they don't "colide", it passes right by it. That's why i was thinking it should be because of the z axis, im using the 2d view from unity4.3.

And doenst 2dtk have a way to generate coliders on its own?

Sorry for all the noob questions, but I just started using 2dtk

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemaps coliders
« Reply #3 on: January 24, 2014, 12:46:16 pm »
It should work. I suggest trying it on the tile map demo first. It will at least rule some thing out.

tk2d doesn't generate shaped colliders on its own at this point. There are plans to integrate into Unitys auto generation, but the necessary interfaces aren't exposed in 4.3

godfader

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Tilemaps coliders
« Reply #4 on: January 24, 2014, 12:53:28 pm »
Seeing the tilemap demo, you use rigidbody and box coliders. Im using rigidbody2D and boxcoliders2D, do you think it can be it? I will test it but takes some time to change the scripts and all the items.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemaps coliders
« Reply #5 on: January 24, 2014, 02:35:44 pm »
It works fine with Rigidbody2d and boxcollider 2d too. You need to change the sprite collection to 2D physics and commit, and change all the rigid body components to rigid body 2d. The tile map demo works with both 2D and 3D physics.