Garry's Mod Wiki

constraint.Pulley

  Entity, Entity, Entity, Entity constraint.Pulley( Entity ent1, Entity ent4, number bone1, number bone4, Vector localPos1, Vector localPos4, Vector worldPos2, Vector worldPos3, number forceLimit, boolean rigid = false, number width, string material = "", table color = color_white )

Description

Creates a pulley constraint.

It consists of 3 rope segments, 2 of which have variable length, visually connected by a 3rd. Reducing length of one end will increase the length of the other end.

You can visualize the pulley like so

WPos2 --- WPos3 | | | | Ent1 Ent4

Arguments

1 Entity ent1
First entity to constrain.
2 Entity ent4
The other entity to attach to.
3 number bone1
PhysObj number of first entity to constrain to. (0 for non-ragdolls).

See Entity:TranslateBoneToPhysBone.

4 number bone4
PhysObj number of second entity to constrain to. (0 for non-ragdolls).

See Entity:TranslateBoneToPhysBone.

5 Vector localPos1
Position relative to the the first physics object to constrain to.
6 Vector localPos4
Position relative to the the second physics object to constrain to.
7 Vector worldPos2
World position constrain the first entity to. This point will be static.
8 Vector worldPos3
World position constrain the second entity to. This point will be static.
9 number forceLimit
Amount of force until it breaks (0 = unbreakable)
10 boolean rigid = false
Whether the constraint is rigid, i.e. cannot bend.
11 number width
Width of the rope. If below or at 0, visual rope segments will not be created.
12 string material = ""
Material of the rope. If unset, will be solid black.
13 table color = color_white
The color of the rope. See Color.

Returns

1 Entity
The created constraint. (phys_pulleyconstraint) Will return false if the constraint could not be created.
2 Entity
The first rope segment. (keyframe_rope) Will return nil if the constraint or this rope segment could not be created.
3 Entity
The second rope segment. (keyframe_rope) Will return nil if the constraint or this rope segment could not be created.
4 Entity
The third rope segment. (keyframe_rope) Will return nil if the constraint or this rope segment could not be created.