Hello Guest

Author Topic: One-sided colliders for platforms (like Bubble Bobble)  (Read 5826 times)

rust

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
One-sided colliders for platforms (like Bubble Bobble)
« on: March 06, 2013, 09:43:32 am »
First: Thanks a lot for a really great tool! It's a real pleasure to work with! :-)

We are building a tilebased platformer and we would really like to have Bubble Bobble-like platforms in it. That is, platforms you can stand on, walk on and jump from. But coming from the bottom and from the sides you can jump through them. Just like the classic Bubble Bobble (take a look here: http://www.youtube.com/watch?v=gggp9JkY1Pk)

I'm very familiar setting up basic colliders, but I'm not a hardcore coder. So I don't know exactly how to achieve this. Maybe a solution could be only to have upwards colliders on the platform. Or have a trigger at the bottom, that turns off the collider, when the character enters from beneath.

Can someone from Unikron or anyone else please help? We really need this in our game!

Thanks in advance! :-)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: One-sided colliders for platforms (like Bubble Bobble)
« Reply #1 on: March 06, 2013, 10:34:17 am »
You could try creating open polygon colliders (i.e. only the top face). There could be issues when Unity actually starts registering the collision - your rigidbody is likely to be pushed out with a lot of force.

Another way of doing this is to disable all rigidbodies above you - if its like bubble bobble it'll be easy, as the platforms are in fixed heights. You can use the y coordinate to decide when to disable the platforms.

rust

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: One-sided colliders for platforms (like Bubble Bobble)
« Reply #2 on: March 06, 2013, 11:09:04 am »
Thanks a lot for the quick reply!

You could try creating open polygon colliders (i.e. only the top face). There could be issues when Unity actually starts registering the collision - your rigidbody is likely to be pushed out with a lot of force.

How do I do that? Using the Polygon-Collider Type in the SpriteCollection-editor, I can't seem to delete any more points, when I'm down to 3... So I can't see how to get the open polygon collider...?

Another way of doing this is to disable all rigidbodies above you - if its like bubble bobble it'll be easy, as the platforms are in fixed heights. You can use the y coordinate to decide when to disable the platforms.

Sounds very interesting, do you by any means have a code sample? :-)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: One-sided colliders for platforms (like Bubble Bobble)
« Reply #3 on: March 06, 2013, 12:20:08 pm »
You can "unconnect" a polygon collider by selecting a node and pressing T on the keyboard. Enable "Show normals" to work out which way is up :)

No, I don't have a code sample, but it should be really really simple to code.
Basically, if the player position is lower than a collider position, turn it off. If the player position is higher than the collider, turn it on.

rust

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: One-sided colliders for platforms (like Bubble Bobble)
« Reply #4 on: March 06, 2013, 04:02:31 pm »
Thanks! Now I also see it in the hints... (a least I hope this helps someone else as well...)

I'll try out both methods. Thanks again! :-)