Entity/GetPhysicsObjectCount

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(fix outdated/irrelevant comments in example)
m
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=GetPhysicsObjectCount
+
|Description=Returns the number of physics objects an entity has (usually 1 for non-ragdolls)
|Parent=Entity
+
|Description=Returns the number of physics object an entity has (usually 1 for non ragdolls)
+
 
|Realm=Shared
 
|Realm=Shared
 
|IsClass=Yes
 
|IsClass=Yes
 +
|Name=GetPhysicsObjectCount
 +
|Parent=Entity
 
}}
 
}}
 
{{Ret
 
{{Ret
Line 15: Line 15:
 
   
 
   
 
  local phys = ragdoll:GetPhysicsObjectNum(i)
 
  local phys = ragdoll:GetPhysicsObjectNum(i)
  phys:ApplyForceCenter( Vector( 0, 0, 10000 )
+
  phys:ApplyForceCenter( Vector( 0, 0, 10000 ) )
  
 
end
 
end
 
}}
 
}}

Revision as of 17:54, 20 March 2016

 Entity:GetPhysicsObjectCount( )

Contents

Description

Returns the number of physics objects an entity has (usually 1 for non-ragdolls)

Returns

number

numObjects

Examples

Example

Finds all the Physics Objects in a ragdoll and applies an upward force

for i=0, ragdoll:GetPhysicsObjectCount() - 1 do -- "ragdoll" being a ragdoll entity
 
 local phys = ragdoll:GetPhysicsObjectNum(i)
 phys:ApplyForceCenter( Vector( 0, 0, 10000 ) )

end


Personal tools
Navigation