summaryrefslogtreecommitdiffstats
path: root/src/entities
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2021-01-17 10:00:41 +0100
committeraap <aap@papnet.eu>2021-01-17 10:00:41 +0100
commit913a001375771a0e837e25d148d173abafdf3290 (patch)
tree6ae9300d5363cd9654531ebd57b351587b975dbe /src/entities
parentMerge remote-tracking branch 'upstream/miami' into miami (diff)
downloadre3-913a001375771a0e837e25d148d173abafdf3290.tar
re3-913a001375771a0e837e25d148d173abafdf3290.tar.gz
re3-913a001375771a0e837e25d148d173abafdf3290.tar.bz2
re3-913a001375771a0e837e25d148d173abafdf3290.tar.lz
re3-913a001375771a0e837e25d148d173abafdf3290.tar.xz
re3-913a001375771a0e837e25d148d173abafdf3290.tar.zst
re3-913a001375771a0e837e25d148d173abafdf3290.zip
Diffstat (limited to 'src/entities')
-rw-r--r--src/entities/Physical.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index 07d1d0b4..f2045b1e 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -547,21 +547,21 @@ CPhysical::ApplyGravity(void)
return;
#ifdef WALLCLIMB_CHEAT
if (gGravityCheat && this == FindPlayerVehicle()) {
- static CVector v1(0.0f, 0.0f, 1.0f), v2(0.0f, 0.0f, 1.0f);
- CVector prop = GetPosition() - (GetUp() + GetUp());
+ static CVector gravityUp(0.0f, 0.0f, 1.0f), surfaceUp(0.0f, 0.0f, 1.0f);
+ CVector belowCar = GetPosition() - 2.0f*GetUp();
CColPoint point;
CEntity* entity;
- if (CWorld::ProcessLineOfSight(GetPosition(), prop, point, entity, true, false, false, false, false, false))
- v2 = point.normal;
+ if (CWorld::ProcessLineOfSight(GetPosition(), belowCar, point, entity, true, false, false, false, false, false))
+ surfaceUp = point.normal;
else
- v2 = CVector(0.0f, 0.0f, 1.0f);
- float coef = clamp(CTimer::GetTimeStep() * 0.5f, 0.05f, 0.8f);
- v1 = v1 * (1.0f - coef) + v2 * coef;
- if (v1.MagnitudeSqr() < 0.1f)
- v1 = CVector(0.0f, 0.0f, 1.0f);
+ surfaceUp = CVector(0.0f, 0.0f, 1.0f);
+ float t = clamp(CTimer::GetTimeStep() * 0.5f, 0.05f, 0.8f);
+ gravityUp = gravityUp * (1.0f - t) + surfaceUp * t;
+ if (gravityUp.MagnitudeSqr() < 0.1f)
+ gravityUp = CVector(0.0f, 0.0f, 1.0f);
else
- v1.Normalise();
- m_vecMoveSpeed -= GRAVITY * CTimer::GetTimeStep() * v1;
+ gravityUp.Normalise();
+ m_vecMoveSpeed -= GRAVITY * CTimer::GetTimeStep() * gravityUp;
return;
}
#endif