BroDynamics 2021.5.26 Update Highlights
Highlight of this release is addition of Cycle\Seamless Looping for Point and Chain modes! Previously available only in Simple Chain mode, it now has made it's way into all primary BroDynamics simulation modes.
This feature is crucial for game development animation, as majority of animations in games are looped, and previously you either had to stick to Simple Chain simulation mode for such animations, or manually adjust animation after simulation to make it loop seamlessly. This new Cycle feature of BroDynamics can now do that for you, which should help save a bit more time when animating! ☺️
How it works
Quite simple, really. Not sure why I haven't thought of it earlier!
Basically it uses the approach where you let the simulation loop over and over until it settles into a seamless cycle. Traditionally this is done by extending you timeline and letting the simulation run, then moving keys from the last loop to your start frame.
BroDynamics does it in a similar manner, but instead of extending the timeline it just copies simulation state from the last frame to the first and runs the simulation again. Effectively this provides the same result without altering your scene in any way, and the "do not touch the rig or intervene with the scene in any way that may break something or leave permanent changes" is and always was at the very core of the idea behind BroDynamics.
For Point mode this is done in quite a simple way, for it is possible to save initial state for Maya's nParticles which are used for this simulation mode. It preserves positions and velocities of particles, and basically does the job properly.
For Chain mode, which is based on nHair, the solution was trickier. For some reason in Maya you can only save Start Position of nHair, which does not preserve inertia and velocities. So to combat that I ended up faking it on my own, by calculating a vector for each point of the hair spline between the last frame and a frame before last, and using that as the new target spline shape for the start frame.