Posted By: Valdsator
Getting Stuck on Ledges - 10/18/11 22:45
I have a rather annoying problem in my game at the moment. Whenever the player tries to jump on to an unreachable ledge, he gets stuck on the corner of the ledge, slowly moving down until he gets unstuck.
What's basically happening is this:
When the player is not on the ground deceleration is set to 0, so that means when stuck here, the player is constantly moving forward (unless he manually moves back). Because the bounding box of the entity is an ellipsoid, it's automatically trying to climb up the ledge so it can continue moving forward, but gravity is also pulling it down, the force getting stronger each frame. This results in the player falling down very slowly, as the forward movement is resisting gravity, and allows the player to glide sideways on the corner. This could be used to exploit the game, or would simply become really annoying for the player because this happens every time you almost make it on to a ledge.
Anyone have any ideas on how I might be able to fix this? I'm thinking I could prevent it if I set x_move and y_move (c_move uses these variables) whenever the entity gets stuck, but I'm not sure how I could identify that the player is in fact stuck. Perhaps there's a way to make it so z_glide is always more important than x and y glide? Maybe I can magically turn the bounding box in to a cylinder? Wishful thinking.
What's basically happening is this:
When the player is not on the ground deceleration is set to 0, so that means when stuck here, the player is constantly moving forward (unless he manually moves back). Because the bounding box of the entity is an ellipsoid, it's automatically trying to climb up the ledge so it can continue moving forward, but gravity is also pulling it down, the force getting stronger each frame. This results in the player falling down very slowly, as the forward movement is resisting gravity, and allows the player to glide sideways on the corner. This could be used to exploit the game, or would simply become really annoying for the player because this happens every time you almost make it on to a ledge.
Anyone have any ideas on how I might be able to fix this? I'm thinking I could prevent it if I set x_move and y_move (c_move uses these variables) whenever the entity gets stuck, but I'm not sure how I could identify that the player is in fact stuck. Perhaps there's a way to make it so z_glide is always more important than x and y glide? Maybe I can magically turn the bounding box in to a cylinder? Wishful thinking.