Garry's Mod Wiki

Entity:SetBoneMatrix

  Entity:SetBoneMatrix( number boneid, VMatrix matrix )

Description

Sets the bone matrix of given bone to given matrix. See also Entity:GetBoneMatrix.

Despite existing serverside, it does nothing.

Arguments

1 number boneid
The ID of the bone
2 VMatrix matrix
The matrix to set.

Example

Example usage of the function.

Aim at an NPC and enter "bones_cl" into your console.

if ( CLIENT ) then concommand.Add( "bones_cl", function( ply ) local ent = ply:GetEyeTrace().Entity if ( !IsValid( ent ) ) then return end ent:AddCallback( "BuildBonePositions", function( ent, numbones ) for i = 0, numbones - 1 do local mat = ent:GetBoneMatrix( i ) if ( !mat ) then continue end local scale = mat:GetScale() mat:Scale( Vector( 1, 1, 1 ) * 0.5 ) ent:SetBoneMatrix( i, mat ) end end ) end ) end