Resources Numerical accuracy Calculation policy

Baked physics key times

The times of the keys written when rigid body physics is baked to the timeline.

How the precision is kept

Each frame of the simulation becomes one key. The key time is rounded to the nearest millisecond, so a frame time that is not a whole number of milliseconds is moved.

Calculations under this policy

1 calculation in 1 source file. The code is read from the released app when this page loads. It is the calculation people run, not a copy kept for this page.

anim/bake.js ModelCraft 0.8.1 64-bit 1 calculation Reviewed

Tests bin/test-animation.mjs

Key time of a baked frame

64-bit

The timeline time given to each baked frame.

t = round((from + f ÷ fps) × 1000) ÷ 1000

One 64-bit expression, then rounded to a millisecond. The rotation of each frame is chosen near the previous frame's rotation (matrixToTRS with near).

  • anim/bake.js
  • line 53
  • ModelCraft 0.8.1
const t = r3(ph.from + f / fps);

In detail

Method
t = round((from + frame ÷ fps) × 1000) ÷ 1000; transforms taken from the 64-bit simulation matrices.
Number types
64-bit numbers.
Tolerances
Key time step 0.001 s. Keys in the baked span are replaced using a window of 1e-9 s around the start and end.
Limits
At 24 frames per second the frame time 1/24 s is stored as 0.042 s, about 0.33 ms late. At 25 or 50 frames per second the times are exact.

Approach: 64-bit, stated limit

The arithmetic is 64-bit, but the method or the data sets the accuracy: a solver tolerance, a mesh, a step size, a datum shift, a table. The limit is stated where the result is shown.

Every policy that takes this approach