Sign in to follow this  

Wall climbing box2d

Recommended Posts

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:


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 logic right???

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

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this