• Advertisement
Sign in to follow this  

Wall climbing box2d

This topic is 2469 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

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:



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 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
Advertisement
Sign in to follow this  

  • Advertisement