Quantum Crouch
Contents
Overview
Quantum Crouch (QC) is a glitch that allows you to keep the standing vertical view offset while crouching. Because crouching hitbox is 36 units tall and standing vertical offset is 64 units, your camera is 28 units above the top of your collision box, allowing you to put it in places not easily accessible for a player.
Execution
To get a QC, you need to have two portals with different orientations (most commonly, axis-aligned floor and wall portals are used). Then, walk into a floor portal so that you're next to the bottom edge, and hug to it using a directional key. As soon as you fall into a floor portal, you should pop right back from it. When that happens, immediately press and hold a duck button and try to strafe away from a portal. At this point you should have QC. To check if that's true, your view offset should be high (it should look like you're standing) but your movement should be slow.
One thing worth mentioning is that sometime you can get something called half-QC. This is caused by a flag that's telling the game whether you're crouching midair or on ground. This flag makes the view offset for crouching/uncrouching different because of the difference between ground crouching and midair crouching. To avoid that, make sure to tap a crouch button before attempting to get QC to reset that flag, so the game thinks you're crouching on ground.
Usage
As mentioned in the overview, QC can be used to get a camera in places that are not easily accessible by a player, which allows them to shoot portals, activate buttons or grab cubes in that area. This can be achieved in several ways:
- by standing directly below the ceiling, being able to look above it (example: Coop Hub Skip),
- by flying to the ceiling, being able to look above it (example: Laser Vs Turret CM route),
- by doing Peek-a-portal. As long as player's hitbox intersects portal's hitbox, if the camera is behind that portal, it will be transformed to peek out of the linked portal. With diagonal portal placement, this allows peeking the camera up to ~22.6 units away from any portal's edge. So far, no use for it has been found.
Technical Explanation
Most of the stuff explained here are based on a simplified version of a ducking code, which can be found in leaked CS:GO repository[1].
Main explanation
There are two ducking-related counters that are used to update the player's view offset: regular duck counter (m_nDuckTimeMsecs
), which is used by the main ducking code and can interpolate the view offset to both ducking and standing position based on your current ducking state, and duck jump counter (m_nDuckJumpTimeMsecs
), which is used in its separate part of the code, unrelated to the ducking code itself and interpolates the view offset only to a standing position. While the main ducking code updates view offset only when ducking or unducking is in progress (player is in in-between state), duck jump counter code works independently, and as long as the counter itself is set, the view offset will be updated according to its value. However, main ducking code takes priority, meaning that it will override the duck jump counter effect if both of them are active.
The duck jump counter in Potal 2 can be activated only by passing through the portal and only in a specific scenario. When you're passing through a portal and the game thinks you should be crouched (by not having enough space for your standing hitbox at that specific time), it will force the ducking state, as well as set the m_bInDuckJump
flag. Then, if you're not holding a duck button and the game thinks you can uncrouch, it will attempt to do so, resetting the m_bInDuckJump
flag, unducking you instantly and appropiately setting the duck jump counter to a specific value. Unfortunately, this alone is useless for us, because we're not ducking, and the duck jump counter will interpolate our view offset to a standing position, which is where it already is, and since uncrouching time is faster than crouching, we cannot crouch in time to actually use the duck jump counter.
What we can do instead is repeat the same process with duck jump counter already active. We enter the portal again, which forces the ducking state, but this time we hold a duck button, preventing the game from uncrouching. Since we're not in in-between state of ducking/unducking, duck jump counter is the only thing updating the view offset, which will eventually set it to a fully standing view offset with nothing to reset it until you release a duck button.
Half-QC
While ducking on ground simply changes the size of your hitbox, resizing it around player's origin (which is at the bottom of the hitbox), ducking midair actually resizes player's hitbox around its center. This is achieved by first moving player up or down (depending on whether we're ducking or unducking) and then resizing the hitbox. Because of that, to make view offset interpolate smoothly to the right position, standing and ducking view offsets are actually different when player's midair. Instead of going from 64 units down to 28 for ducking and from 28 up to 64 for unducking, the offset is actually going from 64 down to 46 for duckig and from 28 up to 46 for standing.
This change is controlled by m_bDuckedInAir
flag, which is updated when you're in in-between state of ducking/unducking. To avoid it being set in order to get full height of Quantuum Crouch, you cannot prematurely duck midair before or when performing QC.
Floor-to-wall portals setup advantage
The reason why floor-to-wall portals setup is easier for getting QC is because the game has a special check that's not allowing the player to unduck from duck jump if they're flinging out of a floor portal with a velocity higher than 200 up. This gives you a bigger buffer of time to press the duck button. That's why other setups (like the one in Catapults) seems to be more precise, because that additional time is not provided.