Box2d wallstick

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Nsmurf
Party member
Posts: 191
Joined: Fri Jul 27, 2012 1:58 am
Location: West coast.

Box2d wallstick

Post by Nsmurf »

Hi,

I'm in the process of making a box2d platformer (don't look at me like that! I have good reasons, I swear!). I's going well, except that there's a bit of wallstick.

See image:
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!
Screenshot 2013-12-03 19.22.41.png (23.84 KiB) Viewed 2053 times
How can I avoid this?

Thanks,

Nsmurf.
OBEY!!!
My Blog
UE0gbWUgd2l0aCB0aGUgd29yZCAnSE1TRycgYXMgdGhlIHN1YmplY3Q=
User avatar
ejmr
Party member
Posts: 302
Joined: Fri Jun 01, 2012 7:45 am
Location: South Carolina, U.S.A.
Contact:

Re: Box2d wallstick

Post by ejmr »

Please upload/attach a '*.love' file so that we can see the code. That really, really helps debugging.
ejmr :: Programming and Game-Dev Blog, GitHub
南無妙法蓮華經
User avatar
Nsmurf
Party member
Posts: 191
Joined: Fri Jul 27, 2012 1:58 am
Location: West coast.

Re: Box2d wallstick

Post by Nsmurf »

Here's the .love, but I'm fairly certain it's a box2d issue, not a coding issue.
Attachments
stuff.love
The .love in question.
(41.48 KiB) Downloaded 62 times
OBEY!!!
My Blog
UE0gbWUgd2l0aCB0aGUgd29yZCAnSE1TRycgYXMgdGhlIHN1YmplY3Q=
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Last edited by bekey on Fri Jan 24, 2014 1:56 am, edited 1 time in total.
User avatar
Nsmurf
Party member
Posts: 191
Joined: Fri Jul 27, 2012 1:58 am
Location: West coast.

Re: Box2d wallstick

Post by Nsmurf »

That looks like it'll fix it, but I'm gonna wait until tomorrow to try it. Thanks!
OBEY!!!
My Blog
UE0gbWUgd2l0aCB0aGUgd29yZCAnSE1TRycgYXMgdGhlIHN1YmplY3Q=
User avatar
ivan
Party member
Posts: 1912
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Box2d wallstick

Post by ivan »

I believe this is caused by the "inside edges" problem where objects get stuck between the ledges of box shapes. It could happen when moving on top of horizontal platforms as well:

Code: Select all

        __
   <---/  \
__ ____\__/___
  |    |    |
  |    |    |
I read somewhere a simple and hacky solution to this problem - make your INSIDE tiles overlapping hexagons:

Code: Select all

  _____________
  | a | b | c |
  |   |   |   |
  -------------
b is an inside tile and a & c are outside tiles.
So basically you have to create a hexagon shape for inside tiles (like b):

Code: Select all

  _________
 /         \
/           \
\           /
 \_________/
This would push the player away from the platform so he wouldn't get stuck:

Code: Select all

 _____ ________ _____
|     /|      |\     |
|a   / |  b   | \  c |
|    \ |      | /    |
|_____\|______|/_____|
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests