(aka No More Slipping)
-------
Update 4/7/16
- Now smooths if the player climbs up a step while in midair.
- Added basic elevation detection using a dummy actor, camera will now account for lift movement instead of squashing/stretching.
- (lift detection is buggy when you stand on the edge, and actor platforms aren't detected at all)
-------
A bit tired of losing control and slipping around whenever Doomguy comes across even the slightest gradation in the ground, I made this script which attempts to keep the player's feet firmly on the floor and let them be able to fully control their movement. This script also takes control over the player's ViewHeight, giving a smoother stair-travelling experience.
Note that you will still fall off stairs if they are too steep to run down. (Also I am not that experienced at ACS so sorry for any newbie-isms)
Credits to Epic MegaGames and Digital Extremes for the smooth camera code, also KeksDose for a tiny bit of code borrowed from Trailblazer.
Download link: https://www.mediafire.com/?o7o73w19j987lic
I also made an example map to help show the difference the script makes, don't run it with the .pk3 though, as an altered version of the script is already embedded within the wad.
You can get the map here: https://www.mediafire.com/?cyrrhg7zp21dd04 (uses outdated version of script!)
[CODE] Smooth stair/camera movement
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
[CODE] Smooth stair/camera movement
Last edited by Turret49 on Mon Jul 04, 2016 6:37 am, edited 4 times in total.
Re: [CODE] Smooth stair/camera movement
Thanks for this, seems to work pretty well. Just wondering, does it have any effect on slopes?
Re: [CODE] Smooth stair/camera movement
[commenting to check this out in future]
Re: [CODE] Smooth stair/camera movement
From what I've looked at the player seems to grip slopes a bit more, but it doesn't appear to have any affect on actual control, sadly.Gutawer wrote:Thanks for this, seems to work pretty well. Just wondering, does it have any effect on slopes?
Updated the OP with a new version after finding some issues with the first one. the new lift detection is really buggy but I'm not sure of a better way to do it. In GZdoom there's even a bug at the start of a map (DUMP 2 MAP28) That is entirely random (somehow arbitrarily based on the size of the script, including commented out text) where the dummy actor reverses its Z height (and FloorZ) information for a couple seconds and I can't figure out how to stop it from happening. Doesn't happen in ZDoom, either.
- BROS_ETT_311
- Posts: 218
- Joined: Fri Nov 03, 2017 6:05 pm
Re: [CODE] Smooth stair/camera movement
Terribly sorry to necropost this, but I swear it's not a useless bump. It seems this code might be a bit broken on newer GZDoom versions, at least 4.0 and up. Currently, the player view height defaults to what looks to be the floor, however...I believe I have a fix! This could be completely wrong, but it seems to do the trick. I know there are ways to do this in zscript (i.e. viewtopic.php?f=105&t=63331), but I figure this ACS still has some value amongst ZDoom 2.8.1 and Zandronum users.
Code: Select all
If( bFalling == 0 && !bJustLanded || LocationZ > OldLocationZ + OldVelZ)
{
bJustLanded = false;
EyeHeight = FixedMul((EyeHeight - LocationZ + (OldLocationZ + LiftMom)), (1.0 - smooth)) + FixedMul(BaseEyeHeight, smooth);
bound = FixedMul(0.25, CollisionHeight);
if (EyeHeight < bound)
{EyeHeight = bound;}
else
{
bound = CollisionHeight;
if ( EyeHeight > bound )
{EyeHeight = bound;}
}
//SetActorProperty(0,APROP_ViewHeight,EyeHeight); //<------------ original code
SetActorProperty(TempTID,APROP_ViewHeight,EyeHeight); //<------------ FIX
}
else
{
smooth = 0.35;
EyeHeight = FixedMul(EyeHeight, (1.0 - smooth)) + FixedMul(BaseEyeHeight, smooth);
bJustLanded = false;
//SetActorProperty(0,APROP_ViewHeight,EyeHeight); //<------------ original code
SetActorProperty(TempTID,APROP_ViewHeight,EyeHeight); //<------------ FIX
}
Re: [CODE] Smooth stair/camera movement
I should look into porting this into ZScript at some point.
- BROS_ETT_311
- Posts: 218
- Joined: Fri Nov 03, 2017 6:05 pm
Re: [CODE] Smooth stair/camera movement
Oh hell yeah! I mean...once your done with ALL of your other projects, of course lol.Nash wrote:I should look into porting this into ZScript at some point.