Garry's Mod Wiki

Entity:TranslatePhysBoneToBone

  number Entity:TranslatePhysBoneToBone( number physNum )

Description

Returns the boneID of the bone the given PhysObj is attached to.

See Entity:TranslateBoneToPhysBone for reverse function.

Arguments

1 number physNum
The PhysObj number on the entity

Returns

1 number
The boneID of the bone the PhysObj is attached to.

Example

Does a trace, gets the physics bone from the trace, converts the physics bone number into the bone number and prints the result

concommand.Add( "boneid", function( ply ) local tr = ply:GetEyeTrace() local bone = tr.Entity:TranslatePhysBoneToBone( tr.PhysicsBone ) print( bone ) ply:ChatPrint( bone ) end )
Output: The bone number of what the client is looking at