Linear Spring

From Fancade Wiki
Revision as of 19:08, 16 May 2024 by Nikitaivanov (talk | contribs) (Created page with "Makes the constraint springy, like a car's suspension. /uploads/Linear Spring.png Inputs: * Constraint: This script must use the output of an add constraint script. This can be done directly (connect the two by a wire), or the linear spring script can be connected to a constraint variable or list. * Stiffness: A vector value. Determines the amount of force that that will be used to "spring" the objects towards their original posit...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Makes the constraint springy, like a car's suspension.

/uploads/Linear Spring.png

Inputs:

  • Constraint: This script must use the output of an add constraint script. This can be done directly (connect the two by a wire), or the linear spring script can be connected to a constraint variable or list.
  • Stiffness: A vector value. Determines the amount of force that that will be used to "spring" the objects towards their original positions.
  • Damping: A vector value. Acts as a kind of "drag" so that objects will not spring continually.

Notes

Before this script will function as expected, a "linear limits" constraint must be applied to the same two objects. The linear limits constraint is necessary because it stores the upper and lower limits between which the objects can move. Adding a linear spring script makes the objects "spring" between these upper and lower limits.

Examples

To find the perfect "stiffness" and "damping" values for your game, try copying the ones below and then adjust them until you get the results you were looking for.

File:Linearspringexample.jpg