Garry's Mod Wiki

Entity:SetPhysConstraintObjects

  Entity:SetPhysConstraintObjects( PhysObj Phys1, PhysObj Phys2 )

Description

When called on a constraint entity, sets the two physics objects to be constrained.

Usage is not recommended as the Constraint library provides easier ways to deal with constraints.

Arguments

1 PhysObj Phys1
The first physics object to be constrained.
2 PhysObj Phys2
The second physics object to be constrained.

Example

From constraint.lua

Constraint = ents.Create("phys_lengthconstraint") Constraint:SetPos( WPos1 ) Constraint:SetKeyValue( "attachpoint", tostring(WPos2) ) Constraint:SetKeyValue( "minlength", "0.0" ) Constraint:SetKeyValue( "length", length + addlength ) if ( forcelimit ) then Constraint:SetKeyValue( "forcelimit", forcelimit ) end if ( rigid ) then Constraint:SetKeyValue( "spawnflags", 2 ) end Constraint:SetPhysConstraintObjects( Phys1, Phys2 ) Constraint:Spawn() Constraint:Activate()