FloatingBodyTests: launch-speed pin sized to the step's position error bound
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
38c47d80ed
commit
83bf1af106
1 changed files with 3 additions and 2 deletions
|
|
@ -54,11 +54,12 @@ public sealed class FloatingBodyTests : IDisposable
|
|||
public void LaunchVelocityDecaysExponentially()
|
||||
{
|
||||
var s = Settings();
|
||||
var start = new KinematicBody { Velocity = new float2(.3f, .4f) };
|
||||
// Speed .3: the semi-implicit step's position error is bounded by speed * dt / 2 (about .005 at dt .1), inside the 1e-2 pin.
|
||||
var start = new KinematicBody { Velocity = new float2(.18f, .24f) };
|
||||
foreach (var dt in new[] { 1f / 120f, .1f })
|
||||
{
|
||||
var b = Run(start, 3f, dt, float2.zero, s);
|
||||
Assert.Equal(.5f * exp(-s.FloatingBodyLaunchDrag * 3f), length(b.Velocity), 4);
|
||||
Assert.Equal(.3f * exp(-s.FloatingBodyLaunchDrag * 3f), length(b.Velocity), 4);
|
||||
}
|
||||
|
||||
var fine = Run(start, 3f, 1f / 120f, float2.zero, s);
|
||||
|
|
|
|||
Loading…
Reference in a new issue