Entity.SetTrigger

From GMod Wiki

Jump to: navigation, search
Function
Syntax Entity:SetTrigger( Boolean enabled )
Description:
Allows you to trigger OnTouch even if the object/player doesn't collide with the object
Returns: nil
In Object: Entity
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.SetTrigger]Entity.SetTrigger [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionUse this in your ENT.Initialize hook to make it act like a trigger.
Used onNewerServer.png
Code
function ENT:Initialize()
   self:SetModel( "models/props_debris/wood_board06a.mdl" )
   self:SetSolid( SOLID_BBOX )
   self:SetTrigger( true )
   self:GetPhysicsObject():EnableMotion( false )
   self:PhysWake( )
   self:SetNotSolid( true )
end
OutputNow the entity calls touch hooks while being not solid. This is how brush triggers( the ones you create in Hammer ) work


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox