simulation_example
A basic example of how to setup a dynamic simulation where one uses a feedback port to maintain the dynamic state between frames, as well as should_simulate
to determine when to solve and when to initialize. For example it will not solve if the frame is not greater than the previously evaluated frame.
Inside this node is a simple example simulation of gravity that one can setup if desired. To do this make this compound editable then inside replace the connections to YOUR_RESET and YOUR_SIMULATION with the two example compounds.
This will initialize by adding a point_velocity property, then simulate by adding gravity each step. To run connect an object like a sphere mesh to both starting_data
and state
and connect the out_state to an output, then playback.
Inputs
starting_data
Connect an object or array of objects to simulate. This could be a complex object with many sub objects that simulate and various simulation settings, if desired. Or it could be a simple geometry object.
state
The simulated object from the previous frame. You do not need to connect anything to this port, but its type should be set to match that connected to starting_data
. One may also simply apply the same connection as starting_data
instead of setting the type. The system will copy the object from the previous frame.
start_frame
The frame at which the simulation starts.
Outputs
out_state
The simulated or the previous object, depending on whether the conditions are met.