14-02-2019, 12:10 PM
(This post was last modified: 14-02-2019, 12:12 PM by josemendez.)
(14-02-2019, 11:37 AM)Richard Wrote: I would like to unfix all fixed particles.
Then iterate over all particles, and set their inverse mass:
Code:
float invMassPerParticle = 0.01f;
for (int i = 0; i < actor.invMasses.Length; ++i){
int indexInSolver = actor.particleIndices[i];
actor.invMasses[i] = solver.invMasses[indexInSolver] = invMassPerParticle;
}
You could of course use a more complicated approach to set the particle masses, such as defining a mass for the whole object and dividing it by the number of particles (to distribute it evenly). Or check for those that are fixed and set a different mass only for them, if desired.