Spring System Integration Method Comparison by michidk - 2

SDK

Spring System Integration Method Comparison

Unity 2019.3.10f1Apache License 2.0Updated 25 days agoCreated on December 21st, 2017
Go to source

Spring System Integration Method Comparison

Following the lecture “Game Physics” at Technical University of Munich (WS17/18), I wanted to implement an actual spring system in Unity to compare the different integration methods.

Screenshot

Requirements

Unity 2019.3

Usage

Open the project with Unity, double click the scene “Scenes/Demo” and enter “Play”-mode. Now move the cube in the editor or the sphere in the game preview using the arrow/WASD keys.

The integration method can be changed in the Simulator component.

All integration method implementations are contained in the “Scripts/Integration” folder.

Comparison

To compare the integrators a bit better, I created a codepen to visualize the performance on a exponential function:

Comparison

The horizontal axis shows the timesteps, the vertical axis the estimated result of the exponential function. As you can see, Runge-Kutta integration (RK4) ist the most accurate method. This was to be expected since its a fourth-order method, which is the highest order of all tested methods.

Show all projects by michidk