Garry's Mod Wiki

constraint.RemoveConstraints

  boolean, number constraint.RemoveConstraints( Entity ent, string type )

Description

Attempts to remove all constraints of a specified type associated with an entity

Arguments

1 Entity ent
The entity to check
2 string type
The constraint type to remove (eg. "Weld", "Elastic", "NoCollide")

Returns

1 boolean
Whether we removed any constraints or not
2 number
The amount of constraints removed

Example

From stools/axis.lua

function TOOL:Reload( trace ) if (!trace.Entity:IsValid() or trace.Entity:IsPlayer() ) then return false end local bool = constraint.RemoveConstraints( trace.Entity, "Axis" ) return bool end