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.
Available Spring Types
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.
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.
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.
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.
Main Functionality
The main functionality and functions of these Spring Types are:
SetValue- Sets the Current ValueGetCurrentValue- Returns the Current ValueSetTarget- Sets the TargetGetTarget- Returns the TargetAddVelocity- 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)SetVelocity- Sets the Velocity to a desired valueGetVelocity- Returns the VelocitySetApplyClamping- Activates or deactivates clamping on the springSetMinValuesandSetMaxValues- Changes the bounds of the clampingStopSpringOnClamp- 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
These are the building blocks of all the spring components of the asset and the building blocks of any custom component you may want to create yourself.
Last updated