Jump to content
  • Advertisement
Sign in to follow this  
jdindia

Looking for tips on 2d platformer physics

This topic is 3669 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm writing a 2d platform game using Box2d. So far I'm just modeling the character as a box (with a sprite pasted on) and applying forces to move around. It's uhm.. interesting. The basic movement is no problem, but wow does the box flip and roll every which way. Preventing Mario from falling on his face or running while laying on his face isn't so easy. >_< It's clear I can do a bit of tweaking, but I imagine others must have come across these problems before. It would be nice to save myself from completely reinventing the wheel.

Share this post


Link to post
Share on other sites
Advertisement
I'm not familiar with Box2D, but most 2D platformers would not even implement rotation of their characters since Mario goes through the entire game standing straight up.

Share this post


Link to post
Share on other sites
Hrmm. I considered forcing him permanently up-right. Certainly the original platformers like Mario Bros. didn't rotate, but they also didn't have a really great physics engine under the hood.

Eventually I'd like to have dangling ropes and big wheels that turn and you can grab onto. It seems like being able to handle rotation would make a lot of that sort of thing easier. If I can solve some of these control problems, I think I get a lot more flexibility in possible physics interactions.

Share this post


Link to post
Share on other sites
You'd probably be better off simulating the player as a point (or possibly a circle). Eliminate rotation from the physics simulation but instead orientate the character based on the surface normal of whatever he's standing on.

Certain aspects will have to take into account the surface normal (jumping for example should apply the jump force along the normal, and friction will probably need to take it into account too).

Share this post


Link to post
Share on other sites
I suggest treating it as a point as well for movement, but use a bounding box for collisions and such. Makes life simple with no rotations!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!