Garry's Mod Wiki

constraint

The constraint library allows you to control the constraint system built into the physics engine (rope, weld, ballsockets, etc).

Methods

constraint.AddConstraintTable( Entity ent1, Entity constrt, Entity ent2 = nil, Entity ent3 = nil, Entity ent4 = nil )
Stores information about constraints in an entity's table.
constraint.AddConstraintTableNoDelete( Entity ent1, Entity constrt, Entity ent2 = nil, Entity ent3 = nil, Entity ent4 = nil )
Stores info about the constraints on the entity's table. The only difference between this and constraint.AddConstraintTable is that the constraint does not get deleted when the entity is removed.
Entity constraint.AdvBallsocket( Entity Ent1, Entity Ent2, number Bone1, number Bone2, Vector LPos1, Vector LPos2, number forcelimit, number torquelimit, number xmin, number ymin, number zmin, number xmax, number ymax, number zmax, number xfric, number yfric, number zfric, number onlyrotation, number nocollide )
Creates an advanced ballsocket (ragdoll) constraint. Uses a https://developer.valvesoftware.com/wiki/Phys_ragdollconstraint
Entity constraint.Axis( Entity Ent1, Entity Ent2, number Bone1, number Bone2, Vector LPos1, Vector LPos2, number forcelimit, number torquelimit, number friction, number nocollide, Vector LocalAxis, boolean DontAddTable )
Creates an axis constraint.
Entity constraint.Ballsocket( Entity Ent1, Entity Ent2, number Bone1, number Bone2, Vector LocalPos, number forcelimit, number torquelimit, number nocollide )
Creates a ballsocket joint.
boolean constraint.CanConstrain( Entity ent, number bone )
Basic checks to make sure that the specified entity and bone are valid. Returns false if we should not be constraining the entity.
Entity constraint.CreateKeyframeRope( Vector pos, number width, string material, Entity Constraint, Entity Ent1, Vector LPos1, number Bone1, Entity Ent2, Vector LPos2, number Bone2, table kv )
Creates a rope without any constraint.
Entity, PhysObj, number, Vector constraint.CreateStaticAnchorPoint( Vector pos )
Creates an invisible, non-moveable anchor point in the world to which things can be attached.
Entity, Entity constraint.Elastic( Entity Ent1, Entity Ent2, number Bone1, number Bone2, Vector LPos1, Vector LPos2, number constant, number damping, number rdamping, string material, number width, boolean stretchonly )
Creates an elastic constraint.
Entity constraint.Find( Entity ent1, Entity ent2, string type, number bone1, number bone2 )
Returns the constraint of a specified type between two entities, if it exists
table constraint.FindConstraint( Entity ent, string type )
Returns the first constraint of a specific type directly connected to the entity found
Entity constraint.FindConstraintEntity( Entity ent, string type )
Returns the other entity involved in the first constraint of a specific type directly connected to the entity
table constraint.FindConstraints( Entity ent, string type )
Returns a table of all constraints of a specific type directly connected to the entity
constraint.ForgetConstraints( Entity ent )
Make this entity forget any constraints it knows about. Note that this will not actually remove the constraints.
table constraint.GetAllConstrainedEntities( Entity ent, table ResultTable = nil )
Returns a table of all entities recursively constrained to an entitiy.
table constraint.GetTable( Entity ent )
Returns a table of all constraints directly connected to the entity
boolean constraint.HasConstraints( Entity ent )
Returns true if the entity has constraints attached to it
Entity, Entity, Entity, Entity constraint.Hydraulic( Player pl, Entity Ent1, Entity Ent2, number Bone1, number Bone2, Vector LPos1, Vector LPos2, number Length1, number Length2, number width, number key, number fixed, number speed, string material )
Creates a Hydraulic constraint.
Entity constraint.Keepupright( Entity ent, Angle ang, number bone, number angularLimit )
Creates a keep upright constraint. This function only works on prop_physics or prop_ragdoll.
Entity, Entity constraint.Motor( Entity Ent1, Entity Ent2, number Bone1, number Bone2, Vector LPos1, Vector LPos2, number friction, number torque, number forcetime, number nocollide, number toggle, Player pl, number forcelimit, number numpadkey_fwd, number numpadkey_bwd, number direction, Vector LocalAxis )
Creates a motor constraint.
Entity, Entity, Entity, Entity constraint.Muscle( Player pl, Entity Ent1, Entity Ent2, number Bone1, number Bone2, Vector LPos1, Vector LPos2, number Length1, number Length2, number width, number key, number fixed, number period, number amplitude, boolean starton, string material )
Creates a muscle constraint.
Entity constraint.NoCollide( Entity Ent1, Entity Ent2, number Bone1, number Bone2 )
Creates an no-collide "constraint". Disables collision between two entities. Does not work with players.
Entity constraint.Pulley( Entity Ent1, Entity Ent4, number Bone1, number Bone4, Vector LPos1, Vector LPos4, Vector WPos2, Vector WPos3, number forcelimit, boolean rigid, number width, string material )
Creates a pulley constraint.
boolean, number constraint.RemoveAll( Entity ent )
Attempts to remove all constraints associated with an entity
boolean, number constraint.RemoveConstraints( Entity ent, string type )
Attempts to remove all constraints of a specified type associated with an entity
Entity, Entity constraint.Rope( Entity Ent1, Entity Ent2, number Bone1, number Bone2, Vector LPos1, Vector LPos2, number length, number addlength, number forcelimit, number width, string material, boolean rigid )
Creates a rope constraint - with rope!
Entity, Entity constraint.Slider( Entity Ent1, Entity Ent2, number Bone1, number Bone2, Vector LPos1, Vector LPos2, number width, string material )
Creates a slider constraint.
Entity constraint.Weld( Entity ent1, Entity ent2, number bone1, number bone2, number forcelimit, boolean nocollide, boolean deleteent1onbreak )
Creates a weld constraint
Entity, Entity, Entity constraint.Winch( Player pl, Entity Ent1, Entity Ent2, number Bone1, number Bone2, Vector LPos1, Vector LPos2, number width, number fwd_bind, number bwd_bind, number fwd_speed, number bwd_speed, string material, boolean toggle )
Creates a Winch constraint.

Page Links


Special Pages


Wikis

?

Render Time: 77ms

DB GetPage 41
Generate Html 3
SaveChanges (1) 11
Render Body 0
Render Sidebar 18