Does anyone know a simple way to "glue" the player to the floor when walking down stairs? Currently with a fast moving player, you will just overshoot the stairs and end up floating in the air when descending stairs.
ZScript and custom player pawn welcome.
"Sticking" player to floor when going down stairs?
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49226
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "Sticking" player to floor when going down stairs?
Not easily. The movement logic already contains code that allows an actor to step down stairs, but this logic will fail if you overshoot the stairs due to too high velocity, because this will be considered moving over a dropoff which results in gravity pulling you down.
Re: "Sticking" player to floor when going down stairs?
grunt grunt grunt grunt grunt :^)
I agree it would be cool to have something like this in.
I agree it would be cool to have something like this in.
- The Zombie Killer
- Posts: 1528
- Joined: Thu Jul 14, 2011 12:06 am
- Location: Gold Coast, Queensland, Australia
Re: "Sticking" player to floor when going down stairs?
This resource from 2016 may be a good starting point. Note that it's written in ACS so it'd first have to be ported to a custom player class.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: "Sticking" player to floor when going down stairs?
One possibility I can imagine is to check, every tick:
- previous floorz
- current floorz
- previous onground status
and use setz to snap the player to the current floorz if
- the current floorz is less than previous floorz
- the difference does not exceed maxstepheight
- previous onground status is true
- previous floorz
- current floorz
- previous onground status
and use setz to snap the player to the current floorz if
- the current floorz is less than previous floorz
- the difference does not exceed maxstepheight
- previous onground status is true
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49226
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "Sticking" player to floor when going down stairs?
That won't do anything because the engine already does it. Like I said above, the problem comes when the player overshoots the next lower stair and the difference between z and floorz is already LARGER than maxstepheight.
Re: "Sticking" player to floor when going down stairs?
I've been thinking a bit about this. I don't think this will ever work script-side. The player's view will "snap" down to the next lower step. There's some hardcoded stuff to handle vertical camera interpolation, but altering the player's Z via brute force through scripting will most probably violently jitter the camera downwards.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49226
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: "Sticking" player to floor when going down stairs?
What you want here wouldn't even work in real life.
Imagine some person running full speed across some stairs. They'd jump across a lot of steps as well because in order to step down properly you have to move slowly.
Imagine some person running full speed across some stairs. They'd jump across a lot of steps as well because in order to step down properly you have to move slowly.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: "Sticking" player to floor when going down stairs?
......huh. That is surprisingly subtle. So that's why stuff seems to drop just a bit faster than midair gravity would suggest....