I'm using Box2D and I am putting edge tiles as b2Bodies so that the tile world can have physics:
The problem is that there are 3 b2_kinematic bodies under the player right beside each other.
Every so often, he gets stuck like in this image (as if there were a very very small slope) and the player box gets stuck. I have to move him back a little to overcome it.
The player has fixed rotation which is what also causes this.
I'm not sure how to fix this.
Any ideas?
Thanks
Answer
The problem you're having is that the player box is getting caught up on those 'side' edges of the tiled physics objects you're using.
The usual advice for this sort of situation is to not create your ground by making a lot of boxes which are placed next to each other. Instead, make just one wide rectangle which covers that whole ground section.
You really don't want your collision mesh to have any edges which the player shouldn't be able to bump against; all they'll do is cause this sort of problem.
No comments:
Post a Comment