Garry's Mod Wiki

Revision Difference

constraint.Elastic#560638

<function name="Elastic" parent="constraint" type="libraryfunc"> <description>Creates an elastic constraint.</description> <description>Creates an elastic rope constraint.</description> <realm>Server</realm> <file line="546-L614">lua/includes/modules/constraint.lua</file> <args> <arg name="Ent1" type="Entity">First entity.</arg> <arg name="Ent2" type="Entity">Second entity</arg>⤶ <arg name="Bone1" type="number">Bone of first entity (0 for non-ragdolls)</arg> <arg name="Bone2" type="number">Bone of second entity (0 for non-ragdolls)</arg> <arg name="LPos1" type="Vector">Position of first end of the rope. Local to Ent1.</arg> <arg name="LPos2" type="Vector">Position of second end of the rope. Local to Ent2.</arg> <arg name="constant" type="number"></arg>⤶ <arg name="damping" type="number"></arg>⤶ <arg name="rdamping" type="number"></arg>⤶ <arg name="material" type="string">The material of the rope.</arg> <arg name="ent1" type="Entity">First entity.</arg> <arg name="ent2" type="Entity">Second entity.</arg>⤶ <arg name="bone1" type="number">Physics Object number of first entity to constrain to. (0 for non-ragdolls).</arg> <arg name="bone2" type="number">Physics Object number of first second to constrain to. (0 for non-ragdolls). Must be different from `bone1`.</arg> <arg name="localPos1" type="Vector">Position relative to the the first physics object to constrain to.</arg> <arg name="localPos2" type="Vector">Position relative to the the second physics object to constrain to.</arg> <arg name="constant" type="number">Stiffness of the elastic. The larger the number the less the elastic will stretch.</arg>⤶ <arg name="damping" type="number">How much energy the elastic loses. The larger the number, the less bouncy the elastic.</arg>⤶ <arg name="rdamping" type="number">The amount of energy the elastic loses proportional to the relative velocity of the two objects the elastic is attached to.</arg>⤶ <arg name="material" type="string" default="">The material of the rope. If unset, will be solid black.</arg> <arg name="width" type="number">Width of rope.</arg> <arg name="stretchonly" type="boolean"></arg>⤶ <arg name="color" type="table">The color of the rope. See <page>Global.Color</page>.</arg> <arg name="stretchonly" type="boolean" default="false"></arg>⤶ <arg name="color" type="table" default="color_white">The color of the rope. See <page>Global.Color</page>.</arg> </args> <rets> <ret name="" type="Entity">Constraint. Will return false if the constraint could not be created.</ret> <ret name="" type="Entity">rope. Will return nil if the constraint could not be created.</ret> <ret name="" type="Entity">The created constraint. ([phys_spring](https://developer.valvesoftware.com/wiki/Phys_spring)) Will return `false` if the constraint could not be created.</ret> <ret name="" type="Entity">The crated rope. Will return `nil` if the constraint could not be created.</ret> </rets> </function>