Basic Usage
To get started with the All In 1 Spring Toolkit, follow these steps:
Add a Spring Component: Choose the appropriate Spring Component for your needs (e.g., TransformSpringComponent, CamFovSpringComponent, AudioSourceSpringComponent) and add it to your GameObject.
Configure Force and Drag: In the Inspector, adjust the Force and Drag parameters to fine-tune the spring behavior. Higher Force will make the spring react more quickly, while higher Drag will make it more stable with less bouncing. You can also use the Springs Debugger to adjust these values in real-time during play mode, which is helpful for quick iteration and fine-tuning.
Set up Auto Update or Manual Control:
For components like TransformSpringComponent, enable "Use Transform As Target" and assign a Target Transform in the Inspector for automatic updates.
If "Use Transform As Target" is disabled, you'll need to call SetTarget() yourself in code.
Most springs have similar ways of deciding if they are automatically updated or not within their General Properties
Some springs, such as FloatSpring, don't have auto-update properties. Interact with these through code by calling SetTarget() manually and using GetCurrentValue() to retrieve and apply the spring's value where needed.
(Optional) Additional Configuration: Depending on the specific Spring Component, you may have additional options to configure, such as clamping values or specific properties to animate.
With these steps, most spring animations will be ready to use with minimal or no code required. The component will handle spring calculations and apply the results to the appropriate properties of your GameObject.
For more dynamic control, reference the Spring Component in your scripts and use its public methods like SetTarget(), AddVelocity(), or GetCurrentValue(). This approach allows you to create responsive behaviors while leveraging the spring system's power.
You'll find numerous examples of these methods and ways to interact with Spring Components in the Demo Examples. All Prefabs in the demo have the main script attached to the parent object, providing practical implementations for reference.
Last updated