Vphys Gravity Height Displacement

From P2SR Wiki

(Redirected from VGHD)

Vphys Gravity Height Displacement


Vphys Gravity Height Displacement (VGHD) is a glitch whereby the player can, in certain conditions, move slowly downwards while flying OOB by moving towards specific yaw angles. around 8 or 82. The glitch appears to work for any angle in (approximately) the ranges 4.5-13.0 and 77.0-85.5, although the rate of height decrease varies depending on the angle chosen - it is most effective around angles 8 or 82. It is used in the any% speedrun as a means of achieving the right height for Flying Mapskip.

Technical Details

VGHD, as the name suggests, is caused by the application of gravity to the player's vphysics shadow box. It occurs when the player is a) out of bounds, b) does not have gravity applied to them, and c) has gravity enabled on their vphys box. This precise set of conditions can be achieved in game using preserved CFG - this state sets the player's gravity to 0, but the action of loading re-enables the vphys shadow's gravity. Reaching OOB can be achieved in several ways, such as with CM Wrongwarp.

Once OOB, it appears that when moving towards the yaw angles described above (4.5-13.0 or 77.0-85.5) the player is occasionally teleported to their vphys shadow; since their shadow has gravity enabled, it is constantly falling, and so is slightly lower than the player. Note that this process does not accelerate the player - their vertical velocity remains at 0 throughout the whole process. As such, it would be inaccurate to describe VGHD as the player "falling".

The player's movement speed also appears to be important. In general, the glitch only occurs if the player has horizontal speed (approximately) between 57.0ups and 63.5ups, with movement being more rapid towards the middle of this range. Luckily, the normal movement speed in air (60ups) lies almost exactly in the middle of this range, meaning it is relatively easy to abuse.

The mechanisms underpinning this glitch are not currently well understood, but it is likely related to the CBasePlayer::VPhysicsShadowUpdate method in the game code. This method is called every physics tick and is responsible for synchronising the state of the vphys shadow to the qphys box after vphysics simulation. As a part of this, it will, in certain situations, teleport the player to their vphys box (generally if it believes they are stuck and more than a small distance from their box). It is assumed that somehow, moving in the manner described above sometimes allows the necessary conditions to be met for the player to be teleported to their physics shadow.