Garry's Mod Wiki

Entity:SetPoseParameter

  Entity:SetPoseParameter( string poseName, number poseValue )

Description

Sets the specified pose parameter to the specified value.

You should call Entity:InvalidateBoneCache after calling this function.

Avoid calling this in draw hooks, especially when animating things, as it might cause visual artifacts.

Arguments

1 string poseName
Name of the pose parameter. Entity:GetPoseParameterName might come in handy here.
2 number poseValue
The value to set the pose to.

Example

Copies pose parameters from one entity to another. Since Entity:GetPoseParameter returns pose parameter values 0-1 on the client, they have to be remapped to the range returned by Entity:GetPoseParameterRange before being set on the target entity.

local function CopyPoseParams(pEntityFrom, pEntityTo) if (SERVER) then for i = 0, pEntityFrom:GetNumPoseParameters() - 1 do local sPose = pEntityFrom:GetPoseParameterName(i) pEntityTo:SetPoseParameter(sPose, pEntityFrom:GetPoseParameter(sPose)) end else for i = 0, pEntityFrom:GetNumPoseParameters() - 1 do local flMin, flMax = pEntityFrom:GetPoseParameterRange(i) local sPose = pEntityFrom:GetPoseParameterName(i) pEntityTo:SetPoseParameter(sPose, math.Remap(pEntityFrom:GetPoseParameter(sPose), 0, 1, flMin, flMax)) end end end