Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding custom particle forces
#2
(26-06-2017, 05:12 PM)herbst Wrote: Hey there, I'm sure I'm overlooking something simple here.
I'm trying to apply custom forces to particles.

So what I did is basically duplicate the ObiSphericalForceZone, since it contains the relevant calls to Oni.AddParticleExternalForces.
However, no matter what I do, this custom script does not apply any forces to the particles.

Is there some magic thing I have to do to make Obi use these custom forces?

Otherwise, I have to put the code directly into the SphericalForceZone or AmbientForceZone, which I'd like to avoid since I am using both already.

You have to apply forces at the correct time.

Do it in LateUpdate(), and ensure your script execution order is set after the solver's (Edit->Project settings->Script execution order). This is what the force zone classes (spherical and ambient) do. 

The reason for this is that the solver clears up force buffers at the end of each frame, so you want to insert forces for the next frame right after this happens.

cheers!
Reply


Messages In This Thread
Adding custom particle forces - by herbst - 26-06-2017, 05:12 PM
RE: Adding custom particle forces - by josemendez - 27-06-2017, 11:41 AM
RE: Adding custom particle forces - by herbst - 27-06-2017, 01:28 PM
RE: Adding custom particle forces - by josemendez - 29-06-2017, 03:27 PM
RE: Adding custom particle forces - by p3gamer - 02-11-2018, 04:16 PM
RE: Adding custom particle forces - by josemendez - 02-11-2018, 07:27 PM
RE: Adding custom particle forces - by p3gamer - 16-11-2018, 09:09 PM
RE: Adding custom particle forces - by josemendez - 17-11-2018, 01:02 PM