Entity/SetPhysConstraintObjects

From Garry's Mod
Jump to: navigation, search
 Entity:SetPhysConstraintObjects( )

Contents

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

PhysObj Phys1

The first physics object to be constrained.

Arguments

PhysObj Phys2

The second physics object to be constrained.

Examples

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()


Personal tools
Navigation