Obi Official Forum

Full Version: Add External force to Fluid Particle
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I want to add an external force to all particles on the screen, could you help me sending a script.

thank you

Renzo
(10-05-2018, 05:57 PM)Renzo Wrote: [ -> ]Hi

I want to add an external force to all particles on the screen, could you help me sending a script.

thank you

Renzo

Hi Renzo,

There's a component included that does exactly this (ObiAmbientForceZone).

If you want to calculate a external force and apply it yourself, call:

Code:
Oni.AddParticleExternalForce(solver.OniSolver,ref force,particleIndices, particleIndices.Length);

"solver" is a ObiSolver component, "force" is a Vector4[] of length 1, and "particleIndices" is a int[] containing the indices of the particles you want the force to affect.
Edit: Force is a Vector4 (instead of Vector3) for memory alignment reasons. The first 3 components should be your force's x,y,z and the 4th component should be zero.

cheers,