06-12-2025, 09:37 PM
Hello
I am trying to set the velocity of cloth particles to 0 so that there is no more movement with the following code:
I execute this code once a certain action occurs in the game.
It works when damping is set to 0.5 but when I reduce the damping I see particles start to move again.
Can you point me in the right direction and verify if I am using the right code to do the job?
Thanks
Aroosh
I am trying to set the velocity of cloth particles to 0 so that there is no more movement with the following code:
Code:
ObiNativeVector4List velocities = actor.solver.velocities;
ObiNativeVector4List angularVelocities = actor.solver.angularVelocities;
ObiNativeVector4List forces = actor.solver.externalForces;
ObiNativeVector4List torques = actor.solver.externalTorques;
for (int i = 0; i < actor.solverIndices.count; i++)
{
int solverIndex = actor.solverIndices[i];
velocities[solverIndex] = Vector3.zero;
angularVelocities[solverIndex] = Vector3.zero;
forces[solverIndex] = Vector3.zero;
torques[solverIndex] = Vector3.zero;
}
actor.UpdateParticleProperties();I execute this code once a certain action occurs in the game.
It works when damping is set to 0.5 but when I reduce the damping I see particles start to move again.
Can you point me in the right direction and verify if I am using the right code to do the job?
Thanks
Aroosh
