Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I would like to know if there is any known solution for handling the player's movement on slopes using Box2D engine.

I tried to do it using a circle as the player. Everything was fine until I tried to walk on slopes, the main problem is that due to gravity, the circle does not stop on the slope.

Please if somebody has tried this before I'll appreciate it. If you have a better solution without the physics engine would be fine for me too.

Thank you.

share|improve this question
    
Try reducing the friction or rotational velocity of the player to zero. –  tesselode Oct 16 '12 at 23:18
    
possible duplicate of Make player to always move along the terrain –  Byte56 Oct 17 '12 at 0:32
    
@Byte56 The question you linked to is to prevent a hop at the top of the ramp. There isn't any overlap. –  ClassicThunder Oct 17 '12 at 2:06
    
@ClassicThunder OK. They seemed pretty similar to me. It is only a possible duplicate after all :) –  Byte56 Oct 17 '12 at 3:02
    
I'll try this too and will let you know the results, thanks. –  songokuhd Oct 17 '12 at 14:09
add comment

1 Answer

Behind boxboy by Robert Dodd describes a very sensible method for making a character in box2d that plays like a more traditional platformer character.

The main components is the anglejoint as well as a fixed speed motor joint. With enough friction your character will not slide down slopes, and as long as the motor is active it would keep it from rolling downhill. I'm uncertain exactly how, but you should be able to keep the motor engaged even when its not rotating, to prevent the circle from rolling freely.

share|improve this answer
    
Thank you!, I'll try this and post my results back here for you to know. –  songokuhd Oct 17 '12 at 14:05
add comment

Your Answer

 
discard

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.