QL stair traversal: conditional velocity clip + air steps
Two changes to PM_StepSlideMove that transform stair traversal: 1. Remove Q3 velocity[2]>0 gate (QL pm_airSteps): allow step-ups while airborne, enabling bunny-hop stair traversal. 2. Conditional velocity clip: only clip velocity to step-down surface when moving INTO it (dot product < 0). Skip clip when velocity is moving away (dot >= 0), preserving upward momentum through steps. This is THE key mechanic for smooth QL-style stair hopping. Also adds 100ms jump cooldown (lastJumpTime) to prevent same-frame double-fires during rapid step-ups. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3327e9680c
commit
043e3a2def
3 changed files with 19 additions and 11 deletions
|
|
@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#define STEPSIZE 18
|
||||
|
||||
#define JUMP_VELOCITY 270
|
||||
#define JUMP_VELOCITY 275
|
||||
|
||||
#define TIMER_LAND 130
|
||||
#define TIMER_GESTURE (34*66+50)
|
||||
|
|
|
|||
|
|
@ -383,6 +383,14 @@ qboolean PM_CanJump( void ) {
|
|||
return qfalse;
|
||||
}
|
||||
|
||||
// QL: 100ms minimum delay between jumps.
|
||||
// Prevents same-frame double-fires. Step jumps launch the player
|
||||
// high enough (~400ms airtime) that the next stair collision
|
||||
// naturally exceeds this threshold.
|
||||
if ( pm->cmd.serverTime - pm->ps->lastJumpTime < 100 ) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -246,15 +246,9 @@ void PM_StepSlideMove( qboolean gravity ) {
|
|||
return; // we got exactly where we wanted to go first try
|
||||
}
|
||||
|
||||
VectorCopy(start_o, down);
|
||||
down[2] -= STEPSIZE;
|
||||
pm->trace (&trace, start_o, pm->mins, pm->maxs, down, pm->ps->clientNum, pm->tracemask);
|
||||
VectorSet(up, 0, 0, 1);
|
||||
// never step up when you still have up velocity
|
||||
if ( pm->ps->velocity[2] > 0 && (trace.fraction == 1.0 ||
|
||||
DotProduct(trace.plane.normal, up) < 0.7)) {
|
||||
return;
|
||||
}
|
||||
// QL pm_airSteps: allow step-ups with upward velocity.
|
||||
// Q3 blocked step-ups during jumps unless ground was directly below.
|
||||
// This prevented smooth stair traversal while bunny-hopping.
|
||||
|
||||
VectorCopy (pm->ps->origin, down_o);
|
||||
VectorCopy (pm->ps->velocity, down_v);
|
||||
|
|
@ -285,9 +279,15 @@ void PM_StepSlideMove( qboolean gravity ) {
|
|||
if ( !trace.allsolid ) {
|
||||
VectorCopy (trace.endpos, pm->ps->origin);
|
||||
}
|
||||
// QL: only clip velocity to step surface when moving INTO it.
|
||||
// Skip clip when velocity is already moving away (preserves
|
||||
// upward momentum through stair steps during bunny-hopping).
|
||||
if ( trace.fraction < 1.0 ) {
|
||||
float vdotn = DotProduct( pm->ps->velocity, trace.plane.normal );
|
||||
if ( vdotn < 0 || fabs( vdotn ) < 0.001f ) {
|
||||
PM_ClipVelocity( pm->ps->velocity, trace.plane.normal, pm->ps->velocity, OVERCLIP );
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// if the down trace can trace back to the original position directly, don't step
|
||||
|
|
|
|||
Loading…
Reference in a new issue