Jump to content

[Box2D] Sticking to walls problem


eddieone
 Share

Recommended Posts

I read another topic that talked about physics hacks to make a platform game work correctly. Someone talked about slowing down movement when near a wall to prevent sticking to walls. I tried this and couldn't get a good result. What is the best way to prevent sticking to walls? The problem seems more about velocity than friction. Though, I'm not exactly sure.

 

physics-wall-stick.png

Link to comment
Share on other sites

  • 2 weeks later...

Your suggestion didn't work but I did find a solution that I like. In short detect right and left hands separately and reduce the side movement when touching.

if (this.leftHand == -1) {
    this.body.moveLeft(100);
} else {
    this.body.moveLeft(15); // fix wall hug
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...