skip to Main Content

Scripting Support (C#)

All the script properties are accesible through its class. To change any property using C# you need to get a reference to the LiquidVolume component of the target gameObject using:

using LiquidVolumeFX;

…

LiquidVolume liquid = <gameobject>.GetComponent<LiquidVolume>();

Then, to change the current fill level to 65%, you can do:

liquid.level = 0.65;

In addition to the look & feel properties, you will find useful the following API:

liquidSurfaceYPosition: returns the world space vertical position of the liquid surface.

GetSpillPoint: returns the position in worls space coordinates of the flask point where the liquid is pouring (for example if the flask is rotated).

BakeTransform: applies current model transform (scale and rotation) to the vertices and then resets the transform to default. This operation is required on models that are rotated by user after import.

CenterPivot: computes the geometric center of all vertices and make the pivot match that center. This is required for models that have a pivot located in another position than the center of the model.

Back To Top