This article's documentation is for Source 2. Click here for more information.

phys_spring

From Valve Developer Community
Jump to: navigation, search

phys_spring is a point entity available in all Source 2 Source 2 games. It is 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 in the spring.

Keyvalues

Entity 1 (attach1) <targetname>
First entity to attach.
Entity 2 (attach2) <targetname>
Second entity to attach.
Spring Axis (springaxis) <vector>
Use the helper. Drag it out to match the virtual spring.
Spring Length (length) <string>
How long the spring would be if it was at rest (nothing hanging on it or attached). 0 means the length of the brush.
Frequency (frequency) <string>
The stiffness of the spring. The larger the number the less the spring will stretch. The maximum should be not more than 30!
Damping Constant (damping) <string>
How much energy the spring loses. The larger the number, the less bouncy the spring.
Name (targetname) <string>
The targetname that other entities refer to this entity by.

Flags

  • 1 : Force only on stretch

Inputs

SetRestLength <float>
Set the spring rest length.
SetFrequency <float>
Set the spring frequency (stiffness).
SetDampingRatio <float>
Set the spring damping ratio.

Base:

RunScriptFile
Load and execute a script file.
RunScriptCode
Execute a fragment of script code.
CallScriptFunction
Call a script function.
CallPrivateScriptFunction
Calls a script function from this entity's private script scope.
CallGlobalScriptFunction
Calls a script function in the global script scope.
Kill
Removes this entity from the world.
KillHierarchy
Removes this entity and all its children from the world.
AddOutput
Adds an entity I/O connection to this entity. Parameter format: OutputName→TargetName→InputName→Parameter→Delay→MaxRefires
FireUser1 to FireUser4
Fires the respectiveOnUseroutputs; see User Inputs and Outputs.

Outputs

Base:

OnUser1 to OnUser4
These outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.
OnKilled
This output fires when the entity is killed and removed from the game. Parameter is the inflictor.