Physics as animation?

Hello,
I made a small animation using physics-engine (applyRadialExplosionForce) and this works fine.
In my project need to jump to any frame of this simulation.
But as I understand it correct this is not seen as a real animation - meaning I cannot jump to any frame of this physics simulation via “beginAnimation”?
If so - what would be a workaround about this: reading all properties (position+rotation) of all meshes during physics-simulation and store these in a big keyframe-array to play everything again with normal animation-API or is there another “best-practice” about this?

Thank you!

As far as I know, you cannot have a physical simulation repeated from a certain point in time.

As a workaround, I would first save the positions of the objects in the first and only complete simulation to a file at certain time intervals (e.g. 100 ms) and then at the real animation I would take the position from the file and manually place the objects at these previously calculated positions.

To get a smoother movement I would take two points each and interpolate them. Therefore it is necessary to save the points of time.

The file would look like this (for a mesh):

Time (ms) | MeshName | x,y,z-Position | x,y,z-Rotation
100 | mesh1 | 10,10,10 | 0,0,0
200 | mesh1 | 10,10,20 | 0,0,3.14
300 | mesh1 | 10.10,50 | 0,0,6.28

Consider that it is not the mesh position and rotation which is calculated with the imposters!

1 Like

I agree and it is a good idea to have such time intervals because I have many meshes and there would be too much data otherwise.
Thank you!