You can simulate physics on your avatar's hair, clothes, and body parts with a little bit of scripting and the help of High Fidelity's Flow script technology.
The Flow script simply mimics the natural movement of hair and other attachments on your avatar. You can manipulate and change how Flow interacts with your avatar using the Flow App. In order to use the Flow App, your avatar must contain flow threads.
On This Page
A flow thread is a set of connected joints with at least one joint that complies with the following rules:
Below are details and descriptions of the Flow app's functionality that will help you control and manipulate your avatar's flow.
While this panel does not affect the actual behavior of your avatar's flow, it will help visually debug your script.
|Avatar||Hides or displays the avatar mesh.|
|Collisions||Allows you to activate or deactivate collisions.|
|Debug||Hides or displays the debug shapes.|
|Solid||Enables either a solid or wireframe display for debug shapes.|
This panel manages all motion related to joints.
|Radius||Determines the thickness of segments and knots (needed for collision testing).|
|Gravity||Sets the Y-value of the gravity vector which represents the direction of gravity as it relates the flow thread.|
|Stiffness||Changes how stiff each thread is.|
|Damping||Determines the amount of joint oscillation.|
|Inertia||Changes the rotational velocity.|
|Delta||Controls the amount of time between each integration step.|
This panel manages collision spheres. Every collision sphere is positioned using an existing avatar joint and offset. The maximum amount of collisions is defined by the global COLLISION_SHAPES_LIMIT = 4.
|Radius||Controls the collision sphere radius.|
|Offset||Controls the collision sphere radius.|
This panel displays the output JSON data structure with your avatar's flow configuration, which you then include in your custom flow.js script.
This data can be copied and pasted into the Flow script between the lines:
// CUSTOM DATA STARTS HERE Erase existing code and paste new code here // CUSTOM DATA ENDS HERE
You can now add the modified Flow script to your avatar's FST file to see your work in action.
In order to attach a script to your avatar, you must modify your avatar's FST file to include the path where your script lives. There are two ways to update your FST file:
script = [FLOW SCRIPT URL HERE].
When packaging your model, the tool will iterate through the directory and add each script to the FST file. Now, you can upload the folder structure to the Marketplace or to your preferred hosting service.
Here is an example of an avatar that is rigged appropriately to use with Flow: Mannequin with Hair.