Garry's Mod Wiki

constraint.Elastic

  Entity, Entity constraint.Elastic( Entity ent1, Entity ent2, number bone1, number bone2, Vector localPos1, Vector localPos2, number constant, number damping, number relDamping, string material = "", number width, boolean stretchOnly = false, table color = color_white )

Description

Creates an elastic rope 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). Must be different from bone1.

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 constant
Stiffness of the elastic. The larger the number the less the elastic will stretch.
8 number damping
How much energy the elastic loses. The larger the number, the less bouncy the elastic.
9 number relDamping
The amount of energy the elastic loses proportional to the relative velocity of the two objects the elastic is attached to.
10 string material = ""
The material of the rope. If unset, will be solid black.
11 number width
Width of rope.
12 boolean stretchOnly = false
Apply physics forces only on stretch.
13 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 created rope. (keyframe_rope) Will return nil if the constraint could not be created.