Garry's Mod Wiki

constraint.Rope

  Entity, Entity constraint.Rope( Entity ent1, Entity ent2, number bone1, number bone2, Vector localPos1, Vector localPos2, number length, number addLength = 0, number forceLimit = 0, number width, string material = "", boolean rigid = false, table color = color_white )

Description

Creates a simple rope (length) based constraint.

Arguments

1 Entity ent1
First entity
2 Entity ent2
Second entity
3 number bone1
PhysObj number of first entity to constrain to. (0 for non-ragdolls).

See Entity:TranslateBoneToPhysBone.

4 number bone2
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 localPos2
Position relative to the the second physics object to constrain to.
7 number length
Length of the rope.
8 number addLength = 0
Amount to add to the length of the rope. Works as it does in the Rope tool.
9 number forceLimit = 0
Amount of force until it breaks (0 = unbreakable).
10 number width
Width of the rope.
11 string material = ""
Material of the rope. If unset, will be solid black.
12 boolean rigid = false
Whether the constraint is rigid.
13 table color = color_white
The color of the rope. See Color.

Returns

1 Entity constraint
The constraint entity (phys_lengthconstraint).

Will be a keyframe_rope if you are roping to the same bone on the same entity. Will return false if the constraint could not be created.

2 Entity rope
The rope entity. Will return nil if constraint return value is a keyframe_rope or if the constraint could not be created.