Hello Guest

Author Topic: Tilemap collider collapsing problem.  (Read 8039 times)

bmyu

  • Newbie
  • *
  • Posts: 8
    • View Profile
Tilemap collider collapsing problem.
« on: June 22, 2014, 01:37:02 pm »
When tilemap is created like http://image.kilho.net/?pk=1642601 and tile collider type is Box-Trimmed, the red line collider part remains collapsed.(Raycast2D doesn't detect that lines.)

Also when collider type is polygon, no matter what collider cap is, http://image.kilho.net/?pk=1642612 the red line collider part remains collapsed.

Physics Engine mode is 2d.
Help !
« Last Edit: June 22, 2014, 01:38:45 pm by bmyu »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #1 on: June 22, 2014, 06:03:32 pm »
Collapsed how? Please post a repro case or a picutre of the collider itself.

bmyu

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #2 on: June 23, 2014, 10:24:05 am »
Edit - removed dropbox link

Here is the unity project.

Tilemap is in the Tilemap folder.
Character things are in Character folder.
« Last Edit: June 23, 2014, 04:45:07 pm by unikronsoftware »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #3 on: June 23, 2014, 05:37:06 pm »
Hi,

I've just had a look and I'm not sure what is wrong with your specific code. Your code seems to work fine with solid colliders (eg. box, etc), but doesn't seem to work properly with edge colliders, and is reproducible with any old box with edge colliders applied by hand. You should probably look into unity forums / answers about edge colliders and raycasts to see if there are any known issues like this / if there are any solutions.

bmyu

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #4 on: June 24, 2014, 09:47:00 am »
OK I found the problem is collider.normal.
Even if the edge collider looks vertical, it's inclined very slightly.. I ignored collision with inclined block due to handle slope tiles. Thanks!

But another question. I questioned before, http://2dtoolkit.com/forum/index.php/topic,4180.0.html, In the same project, the block in question is in my tile sprite collection, 99th (last) tile block.
Compare collider which is seen by sprite collection editor with collider which is created on the scene.
Maybe you've deleted the project already, so here is the project.

Edit - removed dropbox link
« Last Edit: June 24, 2014, 04:17:06 pm by unikronsoftware »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #5 on: June 24, 2014, 04:34:49 pm »
Just had a look, not sure what I'm looking for. They look identical as far as I can tell?

bmyu

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #6 on: June 25, 2014, 08:20:28 am »
What do you see if you edit the polygon collider in the viewport once its created?

-> Vertices are not collapsed in viewport edit mode. But when rigidbody2D is attached, collider doesn't work well.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #7 on: June 25, 2014, 10:14:27 pm »
The rigidbody is attached to that sprite with the weird shapes? Or is something else having problems colliding with this thing?

bmyu

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #8 on: June 26, 2014, 04:00:26 am »
Collider itself is weird.
Editing collider in viewport(with shift key), I can find every vertices that I made. But without shift key, in viewport, the actual collider polygon made of green lines, some vertices are ignored.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #9 on: June 26, 2014, 09:21:20 pm »
Looks exactly the same with or without the shift key.... what do you see?

bmyu

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #10 on: June 28, 2014, 02:16:55 am »
Here is the video. http://youtu.be/6o83zb4kbtc

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #11 on: June 28, 2014, 01:03:03 pm »
Ah I see it now. Its a bug with the unity polygon collider 2d :( You can reproduce it when trying to create the same shape manually in Unity.

bmyu

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #12 on: June 29, 2014, 10:32:06 am »
I noticed the bug occurs when collider is very small.
Unity should fix this quickly.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap collider collapsing problem.
« Reply #13 on: June 29, 2014, 07:46:37 pm »
Please report it the bug, in an isolated project without tk2d ideally for the highest chance of them fixing it.