Entity:GetPhysicsObjectNum
Description
Returns a specific physics object from an entity with multiple PhysObjects (like ragdolls)
See also Entity:TranslateBoneToPhysBone.
Arguments
Returns
Example
When run, if the player is dead it will throw their ragdoll up in the air by their head.
if ( !LocalPlayer():Alive() && LocalPlayer():GetRagdollEntity() ) then
local ent = LocalPlayer():GetRagdollEntity()
local head = ent:GetPhysicsObjectNum( 10 ) // 10 is usually the bone number of the head.
head:ApplyForceCenter( Vector( 0, 0, 6000 ) )
end
Example
Example function that applies force to all physics objects of given entity.
function ApplySomeForce( ent )
for i = 0, ent:GetPhysicsObjectCount() - 1 do
local phys = ent:GetPhysicsObjectNum( i )
phys:ApplyForceCenter( Vector( 0, 0, 10000 ) )
end
end