Hi,
I'm moving my player with SetVelocity whenever my player hitbox is not currently in contact with a left or right wall (90 degree angles). This is to prevent the player from being stuck to the wall if I apply a velocity when he is already in contact with it. So I have set up a few bools like this:
bool touchingRightWall;
bool touchingLeftWall;
In my player class, I override the beginContact and endContact methods and set these bools to true or false depending on the collision normal.
It works great most of the time, but problem is- sometimes the endContact won't seem to be called and therefore my player will think it's still stuck to a wall and it will just not work out the way I intend it to.
I am aware of this stated somewhere: "However, you might miss some contacts because continuous physics leads to sub-stepping. Additionally you may receive multiple callbacks for the same contact in a single time step. You should strive to make your callbacks efficient because there may be many callbacks per time step. ".
But I can't figure out what is causing this or how to solve it. Other solutions for moving the player without making him stuck to the wall are welcome.
Thanks
I'm moving my player with SetVelocity whenever my player hitbox is not currently in contact with a left or right wall (90 degree angles). This is to prevent the player from being stuck to the wall if I apply a velocity when he is already in contact with it. So I have set up a few bools like this:
bool touchingRightWall;
bool touchingLeftWall;
In my player class, I override the beginContact and endContact methods and set these bools to true or false depending on the collision normal.
It works great most of the time, but problem is- sometimes the endContact won't seem to be called and therefore my player will think it's still stuck to a wall and it will just not work out the way I intend it to.
I am aware of this stated somewhere: "However, you might miss some contacts because continuous physics leads to sub-stepping. Additionally you may receive multiple callbacks for the same contact in a single time step. You should strive to make your callbacks efficient because there may be many callbacks per time step. ".
But I can't figure out what is causing this or how to solve it. Other solutions for moving the player without making him stuck to the wall are welcome.
Thanks