PhysObj.EnableGravity

From GMod Wiki

Jump to: navigation, search
Function
Syntax PhysObj:EnableGravity( Boolean gravity )
Description:
Enables or disables the gravity.
Returns: nil
In Object: Physobj
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=PhysObj.EnableGravity]PhysObj.EnableGravity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreates a bugbait with gravity disabled.
Used onNewerShared.png
Code
ent = ents.Create( "prop_physics" )
  ent:SetModel( "models/Weapons/w_bugbait.mdl" )
  ent:SetPos( self.Owner:GetShootPos() )
  ent:SetAngles( self.Owner:GetAngles() )
  ent:SetOwner( self.Owner )
ent:Spawn( )
 
ent:GetPhysicsObject():EnableGravity( false )
OutputN/A


DescriptionDisables gravity on a ragdoll.
Used onNewerShared.png
Code
 local bones = ragdoll:GetPhysicsObjectCount()
 
for i=0,bones-1 do 
 ragdoll:GetPhysicsObjectNum(i):EnableGravity(false)
end
OutputN/A

See also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox