Hey guys I'm using box2d for physics in my tile-based game.
The problem i'm having is what is described in the manual:
"Polygons may not slide smoothly over chains of edge shapes or other polygon shapes that are aligned. For this reason, tile-based environments may not have smooth collision with box-like characters. This problem will be addressed in the future."
Basically if I set my main-character's body as box-like, then he stutters (and sometimes gets stuck) whenever he walks in-between tiles (the tiles are boxes positioned one after another, and hes walking on top of them).
I have kindoff fixed this by making the character's bottom-half a circle instead of a box, this instead makes him occasionally bounce up 1~2 pixels every once in a while, especially when he moves fast...
I was wondering if there is any known way to reduce this jitter, and just have smooth sliding over these boxes. (it really is a shame because this behavior makes box2d almost unusable for 2d tile-based games).
What i'm doing now to fix this, is i have an algorithm that combines line-segments with the same slope that are next to each other into 1 line segment, so that box2d only sees 1 big line, instead of multiple line segments. This is pretty inconvenient since i have to treat different tiles as part of the same body instead of each tile having its own body... But if theres no other solution then its good enough.
The problem i'm having is what is described in the manual:
"Polygons may not slide smoothly over chains of edge shapes or other polygon shapes that are aligned. For this reason, tile-based environments may not have smooth collision with box-like characters. This problem will be addressed in the future."
Basically if I set my main-character's body as box-like, then he stutters (and sometimes gets stuck) whenever he walks in-between tiles (the tiles are boxes positioned one after another, and hes walking on top of them).
I have kindoff fixed this by making the character's bottom-half a circle instead of a box, this instead makes him occasionally bounce up 1~2 pixels every once in a while, especially when he moves fast...
I was wondering if there is any known way to reduce this jitter, and just have smooth sliding over these boxes. (it really is a shame because this behavior makes box2d almost unusable for 2d tile-based games).
What i'm doing now to fix this, is i have an algorithm that combines line-segments with the same slope that are next to each other into 1 line segment, so that box2d only sees 1 big line, instead of multiple line segments. This is pretty inconvenient since i have to treat different tiles as part of the same body instead of each tile having its own body... But if theres no other solution then its good enough.