Game math: precise control over numeric springing
4 days ago
- #game-development
- #procedural-animation
- #numeric-springing
- Numeric springing is a powerful tool for procedural animation, applicable to properties like position, rotation, and scale.
- Common implementation involves parameters like stiffness (k) and damping factor (d), but lacks designer-friendly controls.
- The differential equation for a damped spring system uses angular frequency (ω) and damping ratio (ζ) to define behavior.
- Angular frequency (ω) determines oscillation speed, while damping ratio (ζ) controls how quickly oscillations diminish.
- Designer-friendly parameters include oscillation frequency (Hz) and percentage reduction in oscillation magnitude over time.
- Equations map desired frequency and damping to ω and ζ, enabling precise control over springing effects.
- A C++ implementation demonstrates updating values and velocities using implicit Euler method for stable simulation.
- Example: 4Hz frequency and 99.7% reduction per second creates a visually appealing springing effect.
- Feedback suggests using descriptive variable names in code snippets for better readability.