Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Add External force to Fluid Particle
#1
Hi

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

thank you

Renzo
Reply
#2
(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,
Reply