Entity/IsConstrained

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (Added source code reference)
(Bug (internal links don't work in bug templates for some reason?))
Line 3: Line 3:
 
|Parent=Entity
 
|Parent=Entity
 
|Description=Returns true if the entity has constraints attached to it
 
|Description=Returns true if the entity has constraints attached to it
 +
 +
{{Bug|Issue=3837|This will only update clientside if the server calls it first. This only checks constraints added through the [https://wiki.garrysmod.com/page/Category:constraint constraint library] so this will not react to map constraints.}}
 
|Realm=Shared
 
|Realm=Shared
 
|IsClass=Yes
 
|IsClass=Yes

Revision as of 07:10, 9 May 2019

 Entity:IsConstrained( )

Contents

Description

Returns true if the entity has constraints attached to it

BUG

This will only update clientside if the server calls it first. This only checks constraints added through the constraint library so this will not react to map constraints.

Issue Tracker: #3837

Returns

boolean

Whether the entity is constrained or not.

Examples

Example

From entities/prop_effect.lua

function ENT:PhysicsUpdate( physobj )

	if ( CLIENT ) then return end

	-- Don't do anything if the player isn't holding us
	if ( !self:IsPlayerHolding() && !self:IsConstrained() ) then
		physobj:SetVelocity( Vector(0,0,0) )
		physobj:Sleep() 
	end
end


Personal tools
Navigation