Hello Guest

Author Topic: Solid colliders for sprites are acting like triggers (can be entered into)  (Read 5483 times)

TekuStudios

  • 2D Toolkit
  • Full Member
  • *
  • Posts: 177
    • View Profile
    • Teku Studios
I'm posting this in the public support forum because I think it's important and everyone should be able to read the solution if we come up with one. I'm experiencing a very weird behaviour with custom polygon colliders for sprites lately. Let me show you:

· Step 1: create a sprite collection and draw a custom polygon collider over one of its sprites (as you can see it's a "closed" collider, not an "open" one, like a straight line or something. All vertices are connected. Notice the normals as well).



· Step 2: place the gameObject in the scene and make your character walk over it.



· Step 3: cheerfully watch your character fall into the solid object (I've triple-checked and the Mesh Collider component is NOT trigger, nor is my character).




This is also happenning to me with many walls and other limiters, if their colliders are part of a sprite collection (not Unity built-in ones). I'm using 2DToolkit 2.4.0, any ideas on what may be causing this weird behaviour? The most annoying thing is that some parts of the collider are indeed solid, as you can see in the second image I posted, it's like the box is partially solid and partially a trigger. It seems to happen by pure random.
« Last Edit: October 31, 2014, 06:41:34 pm by TekuStudios »
We are an Indie videogame developer located in Teruel, Spain. A small 6-people team which is currently working on the upcoming 'Candle'.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Solid colliders for sprites are acting like triggers (can be entered into)
« Reply #1 on: November 01, 2014, 10:22:13 am »
Interestingly this has nothing to do with tk2d - we just create a normal polygon collider, so if this is happening you should be able to reproduce it without tk2d at all. If you can create a repro I can look at this for you, I've seen this happen a few times - the 3 main causes are moving colliders incorrectly, wrong scales (physics scale is too small), and things slipping off axis.

TekuStudios

  • 2D Toolkit
  • Full Member
  • *
  • Posts: 177
    • View Profile
    • Teku Studios
Re: Solid colliders for sprites are acting like triggers (can be entered into)
« Reply #2 on: November 03, 2014, 09:24:15 am »
All the colliders that give me this issue are static, so that should not be the case. The Zpos is fixed to 0, so it shouldn't be the slipping either. I'll take a look on the scales, maybe I'm messing things up.


UPDATE: Well, I've double-checked and every collider that fails this way has its transform scale set to 1,1,1, and so is their sprite scale. Maybe it has to do with the collection? We use an Explicit Ortho Size of 1 (we started developing the game with your previous versions of 2DT, so when you changed the default ortho size to 10 it broke our scales, and that's why we must use 1 as the default size for our sprite collections). Could this be what's causing all the trouble?
« Last Edit: November 03, 2014, 09:47:45 am by TekuStudios »
We are an Indie videogame developer located in Teruel, Spain. A small 6-people team which is currently working on the upcoming 'Candle'.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Solid colliders for sprites are acting like triggers (can be entered into)
« Reply #3 on: November 03, 2014, 11:51:25 pm »
If you're using ortho size = 1, then you probably will need to tweak min penetration for penalty in physics settings, gravity too possibly. default unity physics is set up for normal world sized objects, with ortho size =1, the whole world is 2 meters high.

TekuStudios

  • 2D Toolkit
  • Full Member
  • *
  • Posts: 177
    • View Profile
    • Teku Studios
Re: Solid colliders for sprites are acting like triggers (can be entered into)
« Reply #4 on: November 04, 2014, 12:08:21 pm »
Perect, I knew it could be something like that. I'll tweak those values and let you know if this issue is solved.
We are an Indie videogame developer located in Teruel, Spain. A small 6-people team which is currently working on the upcoming 'Candle'.