Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am in the process of creating a physics platformer. However, I want the player movement to feel very old-school(as in: non-physics like), which means that the character:

  • Should always move equally fast horizontally, even on slopes.

  • Has a reasonably fast jumping movement. The 'normal'(earthlike) gravity that is the default of Box2d tends to feel floaty.

Now, I have been trying lots of things to create a Box2d player that works this way. Multiple questions over the past few weeks are related to problems I've encountered with that:

  • I increased the gravity and the density of the player to ensure they would jump/fall faster. (see this question)

  • I worked with the 'unicycle' model(a square connected to a circle) to prevent getting stuck behind small corners. The bad part was that the player was now unable to stay on any slope, because they kept sliding down.

  • To prevent that, I learned that I had to keep the density of both objects low.(see this question) This again created the gravity problem. Also, while the player now was able to keep standing on slopes, moving up on them was still extremely slow (and moving down incredibly fast).

I am getting a bit frustrated now over all this crazy behaviour that doesn't work the way I want it to. Now I am wondering:

Is there something wrong with the approach to handle the player's movement outside of Box2d, and after that let Box2d resolve the new collisions with ground and objects?

Or is this going to be extremely unstable and glitchy because I would 'teleport' the player instead of moving them with forces and is there still another, better way to get the movement I'd like?

share|improve this question
up vote 1 down vote accepted

To make player move equally fast horizontally, even on slopes you can use technique of iforce2d. He changes tangent speed of contact in contact listener. Detailed description you can find there.

share|improve this answer

If you want specific and constrained behaviour, sometimes its easier to set the player as a kinematic body, meaning that it will act over other objects, but not the other way around.

Then you would program the player movement and behaviour yourself, and so it will always be what you expect, avoiding weird physical engines glitches.

You can for example switch to a normal body when the player dies, to get a cool ragdol effect :D

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.