PhysObj.AddGameFlag

From GMod Wiki

Jump to: navigation, search
Function
Syntax PhysObj:AddGameFlag( Number flag )
Description:
Applies a physics flag, making an object behave differently than usual.
Returns: nil
In Object: Physobj
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=PhysObj.AddGameFlag]PhysObj.AddGameFlag [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreates an explosive barrel and launches it into the air, setting it to explode when it hits the ground.
Used onNewerServer.png
Code
local prop = ents.Create("prop_physics")
prop:SetModel("models/props_c17/oildrum001_explosive.mdl")
prop:SetPos(Vector(0,0,0))
prop:Spawn()
local phy = prop:GetPhysicsObject()
if phy:IsValid() then
	phy:ApplyForceCenter(Vector(0,0,10000))
	phy:AddGameFlag(FVPHYSICS_WAS_THROWN)
end
OutputN/A


Additional Notes

SHARED | 0000000000000001 | 00000000000000001 | DMG_SLICE
SHARED | 0000000000000002 | 00000000000000010 | CONSTRAINT_STATIC
SHARED | 0000000000000004 | 00000000000000100 | PLAYER_HELD
SHARED | 0000000000000008 | 00000000000001000 | PART_OF_RAGDOLL
SHARED | 0000000000000016 | 00000000000010000 | MULTIOBJECT_ENTITY
SHARED | 0000000000000032 | 00000000000100000 | HEAVY_OBJECT
SHARED | 0000000000000064 | 00000000001000000 | PENETRATING
SHARED | 0000000000000128 | 00000000010000000 | NO_PLAYER_PICKUP
SHARED | 0000000000000256 | 00000000100000000 | WAS_THROWN
SHARED | 0000000000000512 | 00000001000000000 | DMG_DISSOLVE
SHARED | 0000000000001024 | 00000010000000000 | NO_IMPACT_DMG
SHARED | 0000000000002048 | 00000100000000000 | NO_NPC_IMPACT_DMG
SHARED | 0000000000032768 | 01000000000000000 | NO_SELF_COLLISIONS

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox