Garry's Mod Wiki

Garry's Mod Wiki

  Entity:ManipulateBoneAngles( number boneID, Angle ang, boolean networking = true )

Description

Sets custom bone angles.

When used repeatedly serverside, this method is strongly discouraged due to the huge network traffic produced.

Issue Tracker: 5148

Arguments

1 number boneID
Index of the bone you want to manipulate
2 Angle ang
Angle to apply.

The angle is relative to the original bone angle, not relative to the world or the entity.

3 boolean networking = true
boolean to network these changes (if called from server)

Example

This example shows the network usage impact of repeatedly using bone manipulation serverside.

To see the difference, type in client's console: net_graph 3.

The rotation is not smooth when using Entity:SetNWFloat because it does not update the value on every frame.

local server_only = true -- Change the value! if server_only then if SERVER then hook.Add( "Think", "bone_manipulation_test", function() for _, ent in ipairs( ents.FindByModel( "models/buggy.mdl" ) ) do ent:ManipulateBoneAngles( 28, Angle( 0, 0, RealTime() * 180 ) ) end end ) else hook.Remove( "Think", "bone_manipulation_test" ) end else if SERVER then hook.Add( "Think", "bone_manipulation_test", function() for _, ent in ipairs( ents.FindByModel( "models/buggy.mdl" ) ) do -- Entity:SetNW....() do not broadcast new values instantly. ent:SetNWFloat( "bone_manipulation_test", RealTime() * 180 ) end end ) else hook.Add( "Think", "bone_manipulation_test", function() for _, ent in ipairs( ents.FindByModel( "models/buggy.mdl" ) ) do ent:ManipulateBoneAngles( 28, Angle( 0, 0, ent:GetNWFloat( "bone_manipulation_test" ) ) ) end end ) end end
Output: Rotation of the ammo box of all HL2 buggies.

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...