Answer the question
In order to leave comments, you need to log in
C++, Box2d: How to fix tripping over box corners?
There is a rectangle character that can walk, run and jump.
The entire game world consists mostly of blocks of the same size (some of them can be triangular (slopes) or in rare cases repeat the texture in shape)
The first problem is that when running or sliding the character stumbles over the corner of the block and stops, as if he had crashed into wall (if you step back and try to walk again, you no longer stumble)
The same problem occurs if the character falls against the wall, and with some probability also stumbles over the corner and stands on the corner until he jumps or does a micro- step in a groan.
At the same time, I want to teach the character to move from block to block if he moves with enough speed:
But this is not possible even at over speed, the character still stumbles and falls between the blocks
. I assume that I need to add a modification to the collision check and raise the character to the level of the block if he hits the block at a depth of, for example, 3-5 pixels ( 0.3-0.5 meters) at a speed of at least one meter per second (in any direction).
Making rounded corners of the shape helped the character, but I don't want to resort to this option, because the character needs to cling to the corner of the block without sliding off the cliff.
Answer the question
In order to leave comments, you need to log in
Box2D can only push 2 pieces and that's it. Then turn on your brains.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question