diff options
Diffstat (limited to 'src/game/physics')
| -rw-r--r-- | src/game/physics/movement.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/game/physics/movement.cpp b/src/game/physics/movement.cpp index 61b1cc4..fce9d73 100644 --- a/src/game/physics/movement.cpp +++ b/src/game/physics/movement.cpp @@ -291,7 +291,7 @@ void gmove_check_stuck( VEC3* in_pos ) { gmove->unstuck_vel = { 0, 0, 1.f }; bsp_trace( &t, gmove->bsp, gmove->aabb, pos, pos ); - if( !t.hit ) { + if( !t.hit || !t.startsolid ) { if( vec_len( gmove->velocity ) > 1.f ) { gmove->unstuck_pos = pos; gmove->unstuck_vel = gmove->velocity; @@ -299,6 +299,18 @@ void gmove_check_stuck( VEC3* in_pos ) { return; } + for( U32 i = 0; i < 3; ++i ) { + VEC3 dir = vec3_axis[i]; + VEC3 nudge = pos + dir; + bsp_trace( &t, gmove->bsp, gmove->aabb, pos, nudge ); + if( !t.hit || !t.startsolid ) + return; // not actually stuck, just somewhat inside a solid + + nudge = pos + dir * -1.f; + if( !t.hit || !t.startsolid ) + return; + } + VEC3 p1 = pos; defer( { if( !t.hit ) { |
