Skip to content

The sticky situation part 2

09/11/2011

This is a follow-up from a previous article talking about Box2D collisions issues.

That was a long time I didn’t post anything. But I have good news. The sticky situation is solved! Alleluia!

Hero's hitbox

The good one

The huge mistake I made was that the different shapes were putted together using weld joints. Weld joints were not adapted as the shapes were “floaty”, meaning that the shapes were not strongly attached to each other resulting in disastrous collisions. Not speaking about the joints themselves impossible to manage in the scene and causing bugs.

The solution is not far from the third attempt. But the hitbox was built with the complex body constructor. Here, the different bodies are considered as one body in term of collision, but with different properties. Exactly what I need!

Now, when a side sensor touches a wall, it cancels the hero’s linear velocity in this direction. So the hero’s main body never touches the walls and that prevents the sticky situation!

Advertisements
5 Comments leave one →
  1. 21/11/2011 07:12

    You could also make those sensor boxes on the side into solid fixtures with zero friction.

    • 21/11/2011 09:17

      Wow! iForce2D to the rescue!
      Really? I didn’t think about this possibility. If it works, it will make life easier! I will try this just right now. Thanks for you help!

  2. Cunlop permalink
    30/09/2012 15:35

    I just set my player’s friction to 0 whenever they are not on the ground.

  3. Xbits permalink
    06/02/2013 18:07

    LOL! Thank you Cunlop. So simple!

Trackbacks

  1. The sticky situation part 1 «

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: