Wall Climbing

Hi,
I am new to Box2d and I want to implement a wall climbing feature for my character in my platformer game. I am not sure from where
to get started.

Couple of things which i feel it is needed are:

1) In a wall , sensors are placed at equal distances and then when the character moves it sticks to those points.

is it a correct logic????

All suggestions are welcome...
'POLITE BUMP'

Hi,
Is Implementing the wall climbing feature using Box2d not a efficient way?
Hi
Excuse me for reviving an old topic

But vicer1234 you must try a DistanceJoint for example.

-Your character collides with a wall, you create a DistanceJoint
-When your character jump or another case, you must destroy a DistanceJoint.


Good Luck!
I have done this in two different ways, both were somewhat successful but required a lot of time tweaking and fiddling to get it looking reasonably good. In each case my character had a sensor around his body to detect when something climbable was nearby.

1. Like egyware says, create and destroy distance/rope joints as necessary to 'grab' hold of climbable points which you manually place in the level. While grabbing something, the character is allowed to apply force vertically, even if his feet are not standing on anything. Advantages are that the character can climb on any angle wall and irregular shape locations, and also swing along under a ceiling like a monkey:
http://www.youtube.com/watch?v=diA8TFrs_r4
The disadvantage is that it's not intuitive and hard to control, it really requires having the player manually grab and let go of the points when they want to drop down off the ladder/ceiling. When I started experimenting with the iPhone, this kind of control was not an option for the game I had in mind.

2. Create a temporary prismatic joint to slide up and down a vertical ladder:
http://www.youtube.com/watch?v=PJogpLrkJqg
Actually there's a little more to it than that, because the character can actually still move sideways a little to allow him to climb off at the top. Advantages are more intuitive and easier controls. Disadvantages are the requirement that the ladder be straight, and it required way more tweaking to get right. I also didn't come up with a satisfactory way to do the 'monkey swing' horizontal movement.

Hope this helps.
Hi,
I used distance joint for the wall climbing but getting very unusual behavior.
I am attaching a screen shot showing the case.

Its the yellow box and the blue wall that shows the distance joint been formed and its unusual behavior.

I first used the b2ContactListener to detect the whether the moving ball makes contact with the left wall.

If there is a touch between the two, then i initialize a distance joint like:

Code:

      if(touch)
      {
         b2DistanceJointDef* dist_joint = new b2DistanceJointDef();
      dist_joint->Initialize(movingbox->GetBody(), left->GetBody(), movingbox->GetBody()->GetWorldCenter(), left->GetBody()->GetWorldCenter());
         dist_jt = world.GetWorld()->CreateJoint(dist_joint);
      }


Is this the right logic???

I want that after the distance joint is formed, i can manipulate the yellow box with key strokes to move up and down showing as wall climbing.

All suggestions are welcome
after forming the distance joint between the wall(static) and the character(dynamic) the Upward movement of the character
to show the character climbing wall is not happening.


When a joint is made and then having it to move up or down, what needs to be done, is the joint be maintained or does it have to removed???

also the joint is made between the center of the character and the wall..is it right to form a anchor in the middle of the wall???

Original thread: https://box2d.org/forum/viewtopic.php?t=6881