Revision Difference
phys_spring#547352
<title>phys_spring</title>
# phys_spring
A physically simulated spring. 'Length' is what's known as the 'natural spring length'. This is how long the spring would be if it was at rest (nothing hanging on it or attached). When you attach something to the spring, it will stretch longer than its 'natural length'. The amount of stretch is determined by the 'Spring Frequency'. The larger the spring frequency the less stretch the spring.
In code, it is defined in `SpringConstraint.cs` file under `addons\base\code\Entity\Hammer\Constraints`.
In code, it is defined in the `SpringConstraint.cs` file under `addons\base\code\Entity\Hammer\Constraints`.
## Keyvalues
**Name (`targetname`)**
>* The name that other entities refer to this entity by.
**Tags (`tags`)**
>* A list of general purpose tags for this entity, for interactions with other entities such as triggers.
**Spring Axis (`springaxis`)**
>* Use the helper. Drag it out to match the virtual spring.
**Length (`length`)**
>* How long the spring would be if it was at rest (nothing hanging on it or attached). 0 means the length of the helper.
**Frequency (`frequency`)**
>* The stiffness of the spring. The larger the number the less the spring will stretch. The maximum should be not more than 30!.
**Damping Ratio (`damping`)**
>* How much energy the spring loses. Values less than one give you an osscilating spring. A value of one makes the spring return without overshooting.
**Entity 1 (`attach1`)**
>* The source entity to constrain from. Leave empty to constrain from the world entity.
**Entity 2 (`attach2`)**
>* The entity we constrain to.
**Enable Collision (`enablecollision`)**
>* Constraints disable collision between the attached entities. In some rare cases we want to enable this collision.
**Impulse Limit to Break (kg) (`forcelimit`)**
>* The amount of impulse an impact must apply to the constraint to break it. A way of calculating this is to set it to the mass of an object that would break this constraint if it were resting on the constrainted objects.
**Angular Impulse Limit to Break (kg* distance) (`torquelimit`)**
>* The amount of angular impulse required to break the constraint. A way of calculating this is to multiply any reference mass by the resting distance (from the center of mass of the object) needed to break the constraint.
**Play Sound on Break (`breaksound`)**
>* A sound played when the constraint is broken.