6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood),
1,268
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Getting Stuck on Ledges
#385495
10/18/11 22:45
10/18/11 22:45
|
Joined: Mar 2009
Posts: 186
Valdsator
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 186
|
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.
|
|
|
Re: Getting Stuck on Ledges
[Re: Valdsator]
#385506
10/19/11 08:56
10/19/11 08:56
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
In fact, you can change the Collision type between Ellipsoid(yours) and BBox. i think BBox is what you need since its quadratic without round shapes.
Its a flag in c_move if i remember correctly. USE_BOX.
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: Getting Stuck on Ledges
[Re: Rackscha]
#385536
10/19/11 21:06
10/19/11 21:06
|
Joined: Dec 2008
Posts: 1,660 North America
Redeemer
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,660
North America
|
In fact, you can change the Collision type between Ellipsoid(yours) and BBox. Nope. Its a flag in c_move if i remember correctly. USE_BOX. That's a c_trace flag that causes c_trace to trace a volume, rather than a line. Ironically the volume it traces is an ellipsoid just like c_move(), not a box. There used to be a flag for c_move called USE_AABB that caused c_move to use a box instead of an ellipsoid, but it was removed many versions ago because JCL (gamestudio's lead engineer) decided that Gamestudio's collision system was too big. Gamestudio's implementation of AABB was wimpy anyway; you couldn't adjust the size of the box with min/max but had to be satisfied to use the FAT/NARROW flags, which are really good for nothing. But taking out AABB support was not the right thing to do IMO.
|
|
|
Re: Getting Stuck on Ledges
[Re: Redeemer]
#385611
10/20/11 20:52
10/20/11 20:52
|
Joined: Mar 2009
Posts: 186
Valdsator
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 186
|
That would work great, except ellipsoids are ALWAYS used for entity vs. world interactions. The POLYGON flag only affects entity vs. entity interactions. Yeah, I've already tried this (my actual model is just a cube, since it's an FPS), but all entity vs. level collisions are ellipsoid based. I don't think there's a way to get around that, so I need to find a way to prevent the playing getting stuck, or simply fix the problem quickly whenever it happens. Maybe anyone has any ideas on how I might be able to detect if the player is stuck like this? The player has a c_trace under him checking if he's on the ground, if that changes anything, so when he's stuck gravity is still trying to pull him down, and the game knows he's in the air. Obviously, if the c_trace hits the ledge, then the player will be able to walk up on to it, which is how it should work.
|
|
|
Re: Getting Stuck on Ledges
[Re: Valdsator]
#385617
10/20/11 21:35
10/20/11 21:35
|
Joined: Dec 2008
Posts: 1,660 North America
Redeemer
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,660
North America
|
If you use the USE_BOX flag in your c_trace call then an ellipsoid volume will be traced from the player down to the ground, so even if the player is mostly standing off of a ledge he won't fall. Trace far enough that the ground will be detected even from the far horizontal edges of the ellipsoid and write some code that will keep the player's feet on the ground when the trace returns a hit from a distance.
Last edited by Redeemer; 10/20/11 21:36.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|