Garry's Mod Wiki

constraint.Muscle

  Entity, Entity, Entity, Entity constraint.Muscle( Player player, Entity ent1, Entity ent2, number bone1, number bone2, Vector localPos1, Vector localPos2, number length1, number length2, number width, number key, number fixed, number period, number amplitude, boolean startOn = false, string material = "", table color = color_white )

Description

Creates a muscle constraint.

Very similar to constraint.Hydraulic, but instead of a toggle between fully expanded and contracted, it will continuously alternate between the 2 states while enabled.

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
Width of the rope.
11 number key
The key binding, corresponding to an KEY enum.
12 number fixed
Whether the constraint is fixed, i.e. cannot bend. Must be 1 to act as true.
13 number period
How often the "contractions" should happen.
14 number amplitude
Amplification of the "contractions"?
15 boolean startOn = false
Whether the constraint should start activated. (i.e. spazzing)
16 string material = ""
Material of the rope. If left unset, will be solid black.
17 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.
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.