Class PlayerMovement
Namespace: ValveResourceFormat.Renderer.Input
Assembly: Renderer.dll
Closed-form, framerate-independent solvers for ground movement under combined friction and acceleration: the walk-taper band and the no-prestrafe speed cap.
public class PlayerMovement : IPlayerControllerInheritance
object ← PlayerMovement
Implements
Constructors
PlayerMovement(UserInput)
Initializes a new PlayerMovement bound to the given user input source.
public PlayerMovement(UserInput input)Parameters
input UserInput
The user input instance used to read key state.
Fields
AirAccelerateCompetitive
sv_airaccelerate for competitive play.
public const float AirAccelerateCompetitive = 12Field Value
float
AirAccelerateMovementMaps
sv_airaccelerate for movement maps, far above the engine default so surf and strafe maps have air control.
public const float AirAccelerateMovementMaps = 150Field Value
float
Properties
AirAccelerate
Gets or sets sv_airaccelerate, the air-control acceleration rate.
public float AirAccelerate { get; set; }Property Value
float
AutoBunnyHop
Gets or sets a value indicating whether bunny-hopping is allowed by holding the jump key.
public bool AutoBunnyHop { get; set; }Property Value
bool
BlendedEyeHeight
Gets the current eye height blended between standing and crouched positions.
public float BlendedEyeHeight { get; }Property Value
float
CrouchBlend
Linear value from 0 to 1 representing how much the player is crouched. 0 = standing, 1 = fully crouched.
public float CrouchBlend { get; }Property Value
float
DebugCollisionPlanes
Test-only extra static collision half-spaces layered onto the traces, each a Vector4 whose XYZ is the outward unit normal and W the plane offset d; the half-space n.x <= d is solid. Lets headless tests build walls and overhangs without a physics world. Empty in normal use.
public List<Vector4> DebugCollisionPlanes { get; }Property Value
EmulatedTickRate
Gets or sets the tick rate whose per-tick acceleration step the tickless integrators reproduce. A discrete engine tops the wishdir velocity component up by at most the whole remaining addspeed once per tick, which is a bound on speed gained per unit time; the continuous forms reimpose that bound so they converge to the same trajectory instead of out-accelerating the reference engine as the frame time shrinks.
public float EmulatedTickRate { get; set; }Property Value
float
EyePosition
The current eye position
public Vector3 EyePosition { get; }Property Value
GroundEntity
Gets the entity the player stands on - a brush entity, or the world entity on the map itself - and null in the air. Set from the ground probe every frame.
public BaseEntity? GroundEntity { get; }Property Value
HullCenter
Gets the center of the collision hull, which pushers move the player from. The view can trail it for a tick after a push.
public Vector3 HullCenter { get; }Property Value
HullHalfExtents
Gets the current collision hull half-extents, with height blended between the standing and ducked hulls by PlayerMovement.CrouchBlend.
public Vector3 HullHalfExtents { get; }Property Value
Initialize
Gets or sets a value indicating whether the controller should reinitialize its position from the camera on the next tick.
public bool Initialize { get; set; }Property Value
bool
IsActive
Gets whether the player is being simulated - the viewer's walk mode.
public bool IsActive { get; }Property Value
bool
JumpImpulse
Upward velocity the last jump left the ground with, after stamina.
public float JumpImpulse { get; }Property Value
float
Jumped
Whether a jump left the ground this frame. Leaving it any other way does not count.
public bool Jumped { get; }Property Value
bool
LadderNormal
Gets the normal of the ladder surface being climbed, pointing away from it.
public Vector3 LadderNormal { get; }Property Value
OnGround
Gets a value indicating whether the player is currently on the ground.
public bool OnGround { get; }Property Value
bool
OnLadder
Gets a value indicating whether the player is climbing a ladder.
public bool OnLadder { get; }Property Value
bool
Position
Gets the current player position at feet level (where the AABB touches the ground).
public Vector3 Position { get; }Property Value
PrestrafeEnabled
Gets or sets a value indicating whether ground pre-strafe is allowed.
public bool PrestrafeEnabled { get; set; }Property Value
bool
RideVelocity
Gets the velocity of the mover currently carrying the player, zero on still ground. Riding is positional, so PlayerMovement.Velocity never contains it.
public Vector3 RideVelocity { get; }Property Value
RunSpeed
Gets or sets the base run speed in world units per second.
public float RunSpeed { get; set; }Property Value
float
Stamina
Gets the jump stamina, from 0 to 1. Landing drains it, it recovers over roughly a second, and jump impulses scale by it, so spammed hops get progressively lower.
public float Stamina { get; }Property Value
float
StepSmoothingEnabled
Gets or sets a value indicating whether the view glides up and down stair steps instead of popping.
public bool StepSmoothingEnabled { get; set; }Property Value
bool
Velocity
Gets the current player velocity in world units per second.
public Vector3 Velocity { get; }Property Value
ViewForward
Gets the direction the player is looking.
public Vector3 ViewForward { get; }Property Value
ViewPunchDecay
Gets or sets view_punch_decay, the exponential rate the landing punch recovers at.
public float ViewPunchDecay { get; set; }Property Value
float
ViewPunchDegrees
Gets the view punch from landings and weapon fire, as (pitch, yaw) degrees. This is additive on top of the player's aim for rendering only.
public Vector2 ViewPunchDegrees { get; }Property Value
WasOnGroundLastFrame
Gets a value indicating whether the player was touching the ground in the previous frame.
public bool WasOnGroundLastFrame { get; }Property Value
bool
Methods
AddViewPunch(Vector2)
Adds to the view punch, which then decays at PlayerMovement.ViewPunchDecay.
public void AddViewPunch(Vector2 degrees)Parameters
degrees Vector2
Punch as (pitch, yaw) degrees.
CacheSounds()
Pre-decodes the sounds movement can fire, so the first step does not decode mid-frame.
public static void CacheSounds()ConsumeButtons()
Takes the buttons seen since the last call, reported against the state the previous call left. Called once per tick by the player entity.
public PlayerButtonState ConsumeButtons()Returns
What is held, and what changed, for the tick collecting it.
IsHullStuck(Vector3)
Gets whether the collision hull centered at a point overlaps the world or any collidable entity.
public bool IsHullStuck(Vector3 center)Parameters
center Vector3
Returns
bool
ProcessMovement(Camera, float)
Runs the movement simulation once per rendered frame.
public void ProcessMovement(Camera camera, float deltaTime)Parameters
camera Camera
deltaTime float
Push(Vector3)
Moves the player by a pusher's displacement, already checked for obstruction. The hull moves at once; the view follows over the tick interval, as the pusher is drawn moving.
public void Push(Vector3 delta)Parameters
delta Vector3
ResetPosition(Camera)
Reinitialize the character position from the current camera location. Call this when switching from noclip to FPS movement mode.
public void ResetPosition(Camera camera)Parameters
camera Camera
Teleport(Vector3, Vector3?)
Moves the player somewhere else outright, keeping their velocity.
public void Teleport(Vector3 feetPosition, Vector3? angles)Parameters
feetPosition Vector3
Where the feet arrive.
angles Vector3?
View angles to adopt, or null to keep the current one.
TraceHull(Vector3, Vector3)
Sweeps the collision hull between two centers against the world and all collidable entities.
public Rubikon.TraceResult TraceHull(Vector3 startCenter, Vector3 endCenter)Parameters
startCenter Vector3
endCenter Vector3

