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:
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.
The main functionality and functions of these Spring Types are:
SetValue: Sets the Current Value.
GetCurrentValue: Returns the Current Value.
SetTarget: Sets the Target.
GetTarget: Returns the Target.
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).
SetVelocity: Sets the Velocity to a desired value.
GetVelocity: Returns the Velocity.
SetApplyClamping: Activates or deactivates clamping on the spring.
SetMinValues and SetMaxValues: Changes the bounds of the clamping.
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