Garry's Mod Wiki

CMoveData

A class used to store the inputs from CUserCmd and other information related to the current movement simulation, such as velocity, position and so on.

This can only be accessed during GM:SetupMove , GM:Move , GM:PlayerTick and GM:FinishMove.

Methods

CMoveData:AddKey( number keys )
Adds keys to the move data, as if player pressed them.
Gets the aim angle. Seems to be same as CMoveData:GetAngles.
Angle CMoveData:GetAngles()
Gets the aim angle. On client is the same as Entity:GetAngles.
number CMoveData:GetButtons()
Gets which buttons are down
Returns the center of the player movement constraint. See CMoveData:SetConstraintCenter.
Returns the radius that constrains the players movement. See CMoveData:SetConstraintRadius.
Returns the player movement constraint speed scale. See CMoveData:SetConstraintSpeedScale.
Returns the width (distance from the edge of the radius, inward) where the actual movement constraint functions.
Returns an internal player movement variable m_outWishVel.
Returns an internal player movement variable m_outJumpVel.
Returns an internal player movement variable m_outStepHeight.
Returns the players forward speed.
Gets the number passed to "impulse" console command
Returns the maximum client speed of the player
number CMoveData:GetMaxSpeed()
Returns the maximum speed of the player.
Angle CMoveData:GetMoveAngles()
Returns the angle the player is moving at. For more info, see CMoveData:SetMoveAngles.
Angle CMoveData:GetOldAngles()
Gets the aim angle. Only works clientside, server returns same as CMoveData:GetAngles.
number CMoveData:GetOldButtons()
Get which buttons were down last frame
Vector CMoveData:GetOrigin()
Gets the player's position.
number CMoveData:GetSideSpeed()
Returns the strafe speed of the player.
number CMoveData:GetUpSpeed()
Returns the vertical speed of the player. ( Z axis of CMoveData:GetVelocity )
Vector CMoveData:GetVelocity()
Gets the players velocity. This will return Vector(0,0,0) sometimes when walking on props. Issue Tracker: 3413
boolean CMoveData:KeyDown( number key )
Returns whether the key is down or not
boolean CMoveData:KeyPressed( number key )
Returns whether the key was pressed. If you want to check if the key is held down, try CMoveData:KeyDown
boolean CMoveData:KeyReleased( number key )
Returns whether the key was released
boolean CMoveData:KeyWasDown( number key )
Returns whether the key was down or not. Unlike CMoveData:KeyDown, it will return false if CMoveData:KeyPressed is true and it will return true if CMoveData:KeyReleased is true.
CMoveData:SetAbsMoveAngles( Angle ang )
Sets absolute move angles. ( ? ) Doesn't seem to do anything.
CMoveData:SetAngles( Angle ang )
Sets angles. This function does nothing. Issue Tracker: 2382
CMoveData:SetButtons( number buttons )
Sets the pressed buttons on the move data
CMoveData:SetConstraintCenter( Vector pos )
Sets the center of the player movement constraint. See CMoveData:SetConstraintRadius.
CMoveData:SetConstraintRadius( number radius )
Sets the radius that constrains the players movement. Works with conjunction of: CMoveData:SetConstraintWidth CMoveData:SetConstraintSpeedScale CMoveData:SetConstraintCenter
Sets the player movement constraint speed scale. This will be applied to the player within the constraint radius when approaching its edge.
Sets the width (distance from the edge of the radius, inward) where the actual movement constraint functions.
CMoveData:SetFinalIdealVelocity( Vector idealVel )
Sets an internal player movement variable m_outWishVel.
CMoveData:SetFinalJumpVelocity( Vector jumpVel )
Sets an internal player movement variable m_outJumpVel.
CMoveData:SetFinalStepHeight( number stepHeight )
Sets an internal player movement variable m_outStepHeight.
CMoveData:SetForwardSpeed( number speed )
Sets players forward speed.
CMoveData:SetImpulseCommand( number impulse )
Sets the impulse command. This isn't actually utilised in the engine anywhere.
CMoveData:SetMaxClientSpeed( number maxSpeed )
Sets the maximum player speed. Player won't be able to run or sprint faster then this value. This also automatically sets CMoveData:SetMaxSpeed when used in the GM:SetupMove hook. You must set it manually in the GM:Move hook. This must be called on both client and server to avoid prediction errors. This will not reduce speed in air. Setting this to 0 will not make the player stationary. It won't do anything.
CMoveData:SetMaxSpeed( number maxSpeed )
Sets the maximum speed of the player. This must match with CMoveData:SetMaxClientSpeed both, on server and client. Doesn't seem to be doing anything on it's own, use CMoveData:SetMaxClientSpeed instead.
CMoveData:SetMoveAngles( Angle dir )
Sets the serverside move angles, making the movement keys act as if player was facing that direction. This function is predicted, and should be called shared with matching data on client and server.
CMoveData:SetOldAngles( Angle aimAng )
Sets old aim angles. ( ? ) Doesn't seem to be doing anything.
CMoveData:SetOldButtons( number buttons )
Sets the 'old' pressed buttons on the move data. These buttons are used to work out which buttons have been released, which have just been pressed and which are being held down.
CMoveData:SetOrigin( Vector pos )
Sets the players position.
CMoveData:SetSideSpeed( number speed )
Sets players strafe speed.
CMoveData:SetUpSpeed( number speed )
Sets vertical speed of the player. ( Z axis of CMoveData:SetVelocity )
CMoveData:SetVelocity( Vector velocity )
Sets the player's velocity