Spring Types

The toolkit offers various spring types that can be utilized by any Spring Component (see the next section). These spring types consist of an array of one-dimensional springs, which serve as the foundation of the asset, and a collection of helper functions to interact with the core elements discussed in the previous section. The available spring types are:

  1. Float Spring: A one-dimensional spring. This is the most fundamental and intuitive type, guiding the Current Value towards the Target in a spring-damped motion. It serves as the core of the toolkit, as all other spring types build upon this base.

  2. Vector2, Vector3, Vector4 Spring: These springs have two, three, and four dimensions, respectively. They function similarly to the Spring Float but with additional dimensions, offering the same functionality and methods.

  3. Color Spring: A four-dimensional spring. It operates like the Vector4 spring but includes helper functions and additional features to handle Vector4 to Color conversions.

  4. Rotation Spring: Up to 10 dimensions, although not all are used simultaneously. We employ an axis-angle representation of a quaternion, along with additional dimensions that assist in handling overshoots beyond 180 degrees in the same direction, properly adding velocity, and more. While the implementation details are intricate, we recommend using this spring like the others, as the exposed public methods and workflow are consistent across all spring types.

The main functionality and functions of these Spring Types are:

  1. SetValue: Sets the Current Value.

  2. GetCurrentValue: Returns the Current Value.

  3. SetTarget: Sets the Target.

  4. GetTarget: Returns the Target.

  5. AddVelocity: Adds a specific value to the velocity, used to nudge the spring in a particular direction (see the Nudges and Punches section for more information).

  6. SetVelocity: Sets the Velocity to a desired value.

  7. GetVelocity: Returns the Velocity.

  8. SetApplyClamping: Activates or deactivates clamping on the spring.

  9. SetMinValues and SetMaxValues: Changes the bounds of the clamping.

  10. StopSpringOnClamp: Activates or deactivates the Stop On Clamp feature, which stops the spring when it overshoots the minimum or maximum clamping values. When this occurs, the OnClampingApplied event Action is triggered.

Last updated