When trying to make platformer-style characters the friction model in Box2D feels unrealistic. This is because characters are moved by sliding across the ground, whereas the character is suppose to be walking/running (i.e. not dragging feet).
This causes the following undesirable behaviors:
1) When a character is standing on the top of a stack of boxes & runs off to the left, the boxes topple to the left. The expected behavior would be that they fall to the right, but the friction between the character & box is pushing left.
2) When a character jumps while running & hits his head on the ceiling, he slows down. This could be fixed by making all ceilings have zero friction, but platformers often have the ground/ceiling as the same 'block'. Making the ceiling zero friction doubles your world shapes (worst case)
3) When a character is running & jumping, he slows down quite a bit when he lands because the friction kicks in.
I've looked at different ways of working around these issues, but so far I've not come up with something that works without modifying box2d itself. What I need is more control over friction...here is what I've tried:
* Make the characters heads have zero friction - downside is that other characters can't stand on the head without sliding off.
* Turn off character friction and fake it - this kinda works until you get into kinematic platforms. Then it gets complicated...
* ignore some of these issues and apply a 'counter force' to the platform (fixes #1)
I'm not happy with any of these, so I'm curious what others have done with character friction?
This causes the following undesirable behaviors:
1) When a character is standing on the top of a stack of boxes & runs off to the left, the boxes topple to the left. The expected behavior would be that they fall to the right, but the friction between the character & box is pushing left.
2) When a character jumps while running & hits his head on the ceiling, he slows down. This could be fixed by making all ceilings have zero friction, but platformers often have the ground/ceiling as the same 'block'. Making the ceiling zero friction doubles your world shapes (worst case)
3) When a character is running & jumping, he slows down quite a bit when he lands because the friction kicks in.
I've looked at different ways of working around these issues, but so far I've not come up with something that works without modifying box2d itself. What I need is more control over friction...here is what I've tried:
* Make the characters heads have zero friction - downside is that other characters can't stand on the head without sliding off.
* Turn off character friction and fake it - this kinda works until you get into kinematic platforms. Then it gets complicated...
* ignore some of these issues and apply a 'counter force' to the platform (fixes #1)
I'm not happy with any of these, so I'm curious what others have done with character friction?