- Home /
(Super Mario)Collide when walking on multiple box-collider platform
The box colliders are all same side, same "Y". The character sometime still stuck when walking to the next block, but most of the time he can go smoothly with no problem. I tried to increase the accuracy of physic(dicretes->continueus) on character, doesn't help. Anyone else got the same problem?
p/s: I'm using transform.velocity to move the character
One more time, this should be a common problem, isn't it?
What does the collider on $$anonymous$$ario look like? I suspect its getting caught on the edge.
$$anonymous$$ario having BoxCollider2D. It do get caught at the edge. Adding a Physics$$anonymous$$aterial2D with friction=0 can reduce the chance of this happen dramatically, but it still around.I want to totally eli$$anonymous$$ate it. ][1]
Answer by Rxanadu · Jun 18, 2014 at 04:05 AM
The box colliders for the blocks look to be overlapping each other. Are the Question blocks and brick blocks separate objects, or are they just one sprite?
Either way, I would suggest changing the sizes of the box colliders so they don't overlap each other. That should allow for a smoother area for the player to walk on.
The Question block and brick block are separate collider. It doesn't work when they not collide too. I made them collide just for testing if it can work (not)
Answer by pacific00 · Jun 18, 2014 at 04:25 AM
if possible try to create a single box collider for a whole section of the wall.. instead of individual blocks with colliders.. you will have to code it instead of manually attaching colliders..
Can't do that, $$anonymous$$ario have to jump through those brick after break them too. And it is .. "dirty" to have code for each array of block in game like that. (If you know what I mean ;))
Answer by hexagonius · Jan 16, 2016 at 12:49 PM
The behaviour of colliding with a box when moving another one from the side is a known, by design, issue, which is explained here and won't be fixed:
http://issuetracker.unity3d.com/issues/collision-issues-when-using-2d-box-colliders
I think the suggestion with putting a collider around the whole arrangement is a good approach. When jumping against it from the bottom, you could check which was the closest block, destroy it and recalculate the collider (split it up). Since mario is more like a matrix level, that shouldn't be too hard. If you want to do bottom up jump through, I think Unity 5.4beta1 is capable of that.