Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, SBGuy), 987 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Getting Stuck on Ledges #385495
10/18/11 22:45
10/18/11 22:45
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

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. tongue

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 Offline
Serious User
Rackscha  Offline
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] #385535
10/19/11 20:47
10/19/11 20:47
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Hm, didn't change a thing. I think USE_BOX is used for c_trace, which still uses the ellipsoid of the entity, rather than an actual box.

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 Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
Originally Posted By: Rackscha
In fact, you can change the Collision type between Ellipsoid(yours) and BBox.

Nope. wink

Originally Posted By: Rackscha
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.


Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: Getting Stuck on Ledges [Re: Valdsator] #385563
10/20/11 00:31
10/20/11 00:31
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
I tried checking the vec_length of the vector (x_move * time_step, y_move * time_step, 0), because this should equal the distance variable the c_move returns as long as nothing is in the way. I could use this to identify when the player was in the air, and stuck/gliding on something. This didn't really work (just moving around would set it off), so still looking for a way to fix this.

Re: Getting Stuck on Ledges [Re: Valdsator] #385565
10/20/11 02:47
10/20/11 02:47
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482
You can use the old trick invisible-collision-cube.
Change your model to a cube, set it visible to false, c_move it using POLYGON enabled, then put another dummy entity that represent your actual model at the cube position.

Re: Getting Stuck on Ledges [Re: bart_the_13th] #385604
10/20/11 20:18
10/20/11 20:18
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
That would work great, except ellipsoids are ALWAYS used for entity vs. world interactions. The POLYGON flag only affects entity vs. entity interactions.


Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: Getting Stuck on Ledges [Re: Redeemer] #385611
10/20/11 20:52
10/20/11 20:52
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Originally Posted By: Redeemer
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 Offline
Serious User
Redeemer  Offline
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.

Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: Getting Stuck on Ledges [Re: Redeemer] #385635
10/21/11 03:39
10/21/11 03:39
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Well, by using USE_BOX I was able to make it harder to get stuck, but it still happens every time you jump on to a ledge diagonally. Any ideas?

Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1