Garry's Mod Wiki

constraint.Hydraulic

  Entity, Entity, Entity, Entity constraint.Hydraulic( Player player, Entity ent1, Entity ent2, number bone1, number bone2, Vector localPos1, Vector localPos2, number length1, number length2, number width, number key, number slider, number speed, string material = "", table color = color_white )

Description

Creates a controllable constraint.Elastic, aka a Hydraulic constraint.

Arguments

1 Player player
The player that will be able to control the constraint. Used to call numpad.OnDown.
2 Entity ent1
First entity.
3 Entity ent2
Second entity.
4 number bone1
PhysObj number of first entity to constrain to. (0 for non-ragdolls).

See Entity:TranslateBoneToPhysBone.

5 number bone2
PhysObj number of second entity to constrain to. (0 for non-ragdolls). Must be different from bone1.

See Entity:TranslateBoneToPhysBone.

6 Vector localPos1
Position relative to the the first physics object to constrain to.
7 Vector localPos2
Position relative to the the second physics object to constrain to.
8 number length1
Minimum length of the constraint.
9 number length2
Maximum length of the constraint.
10 number width
The width of the rope.
11 number key
The key binding, corresponding to an KEY enum
12 number slider
Whether the hydraulic is fixed, i.e. cannot bend. Must be 1 to act as true.
13 number speed
How fast it changes the length from length1 to length2 and backwards.
14 string material = ""
The material of the rope. If unset, will be solid black.
15 table color = color_white
The color of the rope. See Color.

Returns

1 Entity
The created constraint. (phys_spring) Will return false if the constraint could not be created.
2 Entity
The crated rope. (keyframe_rope) Will return nil if the constraint could not be created.
3 Entity
The muscle controller. (gmod_winch_controller) Will return nil if the constraint could not be created.
4 Entity
The slider (phys_slideconstraint) if fixed was exactly 1. Will return nil otherwise, or if the constraint could not be created.