Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Applying custom forces - AddWind or AddParticleExternalForces?
#1
Hi,

I'm generating Drag and Lift force vectors that I would like to apply directly, ideally avoiding AerodynamicConstraints.

As far as I can tell, there are two ways to apply external forces to particles: Oni.AddWind and Oni.AddParticleExternalForces.

I was wondering how these APIs differ, and when each should be used?

Finally, for this situation, should I be applying forces differently if UsesCustomExternalForces is set, what exactly does this mean?


Much appreciated.
Reply
#2
(16-04-2018, 01:39 PM)jabza Wrote: Hi,

I'm generating Drag and Lift force vectors that I would like to apply directly, ideally avoiding AerodynamicConstraints.

As far as I can tell, there are two ways to apply external forces to particles: Oni.AddWind and Oni.AddParticleExternalForces.

I was wondering how these APIs differ, and when each should be used?

Finally, for this situation, should I be applying forces differently if UsesCustomExternalForces is set, what exactly does this mean?


Much appreciated.

Hi there,

You should use AddParticleExternalForces().

AddWind() adds wind for each particle (direction and intensity vector), that is used to internally calculate drag and lift forces for all particles in each cloth triangle using the thin airfoil aerodynamic equations.

AddParticleExternalForces directly applies a force to each particle. So if you are calculating your own drag/lift forces, you should use it instead of AddWind.

UsesCustomExternalForces is deprecated and will be removed in 4.0. For now it sits there to ensure compatibility with old versions. It was used to differentiate between wind and external force, but now two separate methods exist (AddWind and AddParticleExternalForces) so it is no longer used.
Reply
#3
(16-04-2018, 02:30 PM)josemendez Wrote: Hi there,

You should use AddParticleExternalForces().

AddWind() adds wind for each particle (direction and intensity vector), that is used to internally calculate drag and lift forces for all particles in each cloth triangle using the thin airfoil aerodynamic equations.

AddParticleExternalForces directly applies a force to each particle. So if you are calculating your own drag/lift forces, you should use it instead of AddWind.

UsesCustomExternalForces is deprecated and will be removed in 4.0. For now it sits there to ensure compatibility with old versions. It was used to differentiate between wind and external force, but now two separate methods exist (AddWind and AddParticleExternalForces) so it is no longer used.

Great, thanks for the help.
Reply
#4
Just to add to this, does Oni.AddParticleExternalForce apply the force provided evenly accross all particles? 

IE: If my custom force magnitude is 10, and I have 2 particles, does each particle recieve a force of magnitude 5, or 10?

And finally, am I expected to provide my force * Time.fixedDeltaTime, or is the timestep accounted for in Oni?

Thanks again!
Reply
#5
(16-04-2018, 08:09 PM)jabza Wrote: Just to add to this, does Oni.AddParticleExternalForce apply the force provided evenly accross all particles? 

IE: If my custom force magnitude is 10, and I have 2 particles, does each particle recieve a force of magnitude 5, or 10?

And finally, am I expected to provide my force * Time.fixedDeltaTime, or is the timestep accounted for in Oni?

Thanks again!

Hi there,

Forces always are applied over a given time (usually fixedDeltaTime). You don't need to multiply them by the delta yourself. If they were applied instantly they would not be called forces, but impulses Sonrisa.

The force you pass is applied to all particles, it does not get divided by the amount of particles. In your example, both particles would receive a force of 10.
Reply