Skip to content

Commit

Permalink
Handle zero time steps. Throw ArgumentException for negative time ste…
Browse files Browse the repository at this point in the history
…ps. (#110)
  • Loading branch information
notgiven688 authored Mar 23, 2024
1 parent 88dc590 commit a5831ea
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Jitter2/World.Step.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ public void Step(float dt, bool multiThread = true)
{
AssertNullBody();

if (dt < 0.0f)
{
throw new ArgumentException("Time step cannot be negative.", nameof(dt));
}

if(dt == 0.0f) return; // nothing to do

long time = Stopwatch.GetTimestamp();
double invFrequency = 1.0d / Stopwatch.Frequency;

Expand Down

0 comments on commit a5831ea

Please sign in to comment.