Fluid Setup

Here we will cover the basic usage of Obi's fluid component: ObiEmitter.

Emitters, as their name implies, emit fluid particles into your scene. They are similar to Unity's built-in particle emitters, but they do not emit regular particles. Instead, they emit Obi particles, which can interact with each other as well as other objects.

You can add a ObiEmitter component to a GameObject by clicking Component->Physics->Obi->Obi Emitter, or by clicking the "Add Component" button in the inspector of any object, then searching for "Obi Emitter"

By default, all particles will be emitted from the object's origin. Except for very simple effects, you will want a more complex shape to be used as the source for emitting particles. You can add any of ObiEmitterShape components (square, disk, edge, sphere or image) to any object in your scene, and drag the ObiEmitter component onto its "emitter" property. This will allow the emitter to emit trough that particular shape.

If you hit play now, nothing will happen. This is because ObiEmitter only creates particles and sets up fluid constraints between them, but does not perform any simulation by itself. That is the job of the ObiSolver component. This component can be attached to any GameObject in your scene, so go ahead and add it to any existing object or create an empty GameObject for it. Once you have your ObiSolver, make sure it has at least the same amount of particles as your emitter's "Num Particles" property, and then feed it to the ObiEmitter component by assigning it to its "Solver" property.

Also, we need some way to visualize our particles. The most basic way to render them is to use the ObiParticleRenderer component. Just add it to the emitter to visualize your particles.