Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I translate all the particles' position by a certain vector?
#2
(07-09-2020, 11:36 AM)emz06 Wrote: Hi,

-I have fluid particles (shampoo-type of liquid) resting on a platform.

-Suddenly this platform shifts downward, and to the side.

But the problem is the particles can't keep up with the high speed of the platform.
I tried to increase the friction, but it did not help.

Is it possible to loop through all the particles and, on every frame, translate their position by the same amount as the platform movement?

Yes, you can. Make sure to also translate their previousPosition, as this is PBD (and velocities are calculated as (position - prevPosition) / dt). If you only change their current position, they will gain a lot of velocity.

See:
http://obi.virtualmethodstudio.com/tutor...icles.html

Example:
Code:
for (int i = 0; i < actor.solverIndices.Length; ++i){

     // retrieve the particle index in the solver:
     int solverIndex = actor.solverIndices[i];


     actor.solver.positions[solverIndex] += translation;
     actor.solver.prevPositions[solverIndex] += translation;
}
Reply


Messages In This Thread
RE: Can I translate all the particles' position by a certain vector? - by josemendez - 07-09-2020, 11:47 AM