Garry's Mod Wiki

constraint.Winch

  Entity, Entity, Entity constraint.Winch( Player player, Entity ent1, Entity ent2, number bone1, number bone2, Vector localPos1, Vector localPos2, number width, number fwdBind, number bwdBind, number fwdSpeed, number bwdSpeed, string material = "", boolean toggle = false, table color = color_white )

Description

Creates a winch constraint, a player controllable constraint.Elastic, allowing gradually increasing or decreasing the length.

Arguments

1 Player player
The player that will be used to call numpad.OnDown and numpad.OnUp.
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).

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 width
The width of the rope.
9 number fwdBind
The key binding for "forward", corresponding to an KEY enum
10 number bwdBind
The key binding for "backwards", corresponding to an KEY enum
11 number fwdSpeed
Forward speed.
12 number bwdSpeed
Backwards speed.
13 string material = ""
The material of the rope. If unset, will be solid black.
14 boolean toggle = false
Whether the winch should be on toggle.
15 table color = color_white
The color of the rope. See Color.

Returns

1 Entity
The created constraint. (phys_spring) Can return nil. 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 winch controller. (gmod_winch_controller) Can return nil.