Mixing keyframe animation and simulation
Activating and deactivating RBD objects
You can use the Activate objects and Deactivate objects tools on the Drive simulation tab to keyframe switching an object between active (simulated) and inactive (manually keyframe animated). This lets you take manual control of a simulated object for a certain number of frames, then put it back under the control of the simulation.
These shelf tools add an RBD Keyframe Active node to the dynamics system. This node has an Active parameter that controls whether the object uses its simulated position and rotation (Active = 1) or its keyframed position and rotation (Active = 0).
When the object is inactive (Active = 0), keyframe the RBD Keyframe Active node’s Position and Rotation parameters to move and rotate the object manually, not the object-level transforms.
When you're keyframing the Active value yourself, remember to use a
constant animation curve on the channel instead of the default. See how to use the channel editor.
Switching between an object’s animated position and simulated position
Keyframe the object at the object level.
Select the object and use RBD Object on the RBD shelf tab to make it a simulated object.
Double-click the dynamics network node to go inside.
Select the RBD Object node for the object. In the parameter editor turn on Create active object and turn off Use object transform.
Use the RBD Object’s Position and Rotation parameters to position the simulated object.
Add an Active Value node after the RBD Object and set its Default operation to “Set always” (so Houdini re-evaluates whether the object is active at each frame).
The Active parameter of this node controls whether the object is active (controlled by the simulation) or not.
Add an OBJ Position DOP after the Active Value node and set its Object path parameter to the same object imported by the RBD Object node. Set the Default operation to “Set always” (so Houdini fetches the position at each frame).
OBJ Position gets the position of the object from the object (OBJ) level, overriding the position computed by the simulation.
Next you will set up a parameter reference to link the states of the Active Value and OBJ Position nodes to each other.
When the object is active (that is, being simulated), the Active parameter on the Active Value node should be 1, and the Activation parameter of the OBJ Position node should be 0 (because you want to simulate the object’s motion, not copy it from the keyframe animation). Conversely, when the object is being controlled by its keyframe animation, the Active parameter on the Active Value node should be 0, and the Activation parameter of the OBJ Position node should be 1 (because you want to copy
Press on the Active parameter of the Active Value node and choose Copy Parameter, then press on the Activation parameter of the OBJ Position node and choose Paste Copied References. Edit the pasted expression to put a
!(logical not) in front of the ch function.
This makes the Activation parameter of the OBJ Position node always be the logical opposite of the Active parameter of the Active Value node.
Now you can keyframe the value of the Active Value node’s Active parameter to switch between the keyframed position and the simulated position.
Blending between an object’s keyframed position and simulated position
The Blend solver runs objects through multiple solvers and blends the results.
The Copy solver copies a piece of data to a new name. You can have position data named
KeyFrame (from an OBJ Position DOP), which stores keyframed positions. You can have the
KeyFrame data exist at all times, but only copy it over the
Position data (which controls object position) at certain frames.
To blend smoothly between keyframe animation and simulation, you can use the Blend solver to blend between the results of, for example, an RBD solver and a Copy solver which copies the
KeyFrame data over the
To see an example of this setup, see the
SimpleBlend example file in the Blend solver online help.
You can keyframe the position of a hard or soft constraint to gain some manual control over a simulation.
Keyframing parts at the geometry (SOP) level
You can “cheat” animation on top of the simulated motion by using the Transform surface node to keyframe moving and rotating the object’s geometry around “inside” the object.
You can combine this with deactivating the object in the simulation to keep the simulation from moving the object while you keyframe the geometry inside.
If you have some rigid motion at the geometry (SOP) level and want to hand that off to the simulation, use the Trail SOP to calculate point velocity attributes, then in the dynamics network add an RBD State DOP and turn on the Inherit velocity option to set up the velocities at the hand-off frame.
It doesn’t make much sense to do this for a single object. However, you can use this if you have a glued-together object whose sub-pieces are traveling at different speeds (because of capture/deform). The RBD Glue Object and RBD Fracture Object DOPs include the Inherit velocity parameter to make this easier.