22-09-2026, 07:36 AM
(This post was last modified: 22-09-2026, 07:38 AM by josemendez.)
(22-09-2026, 07:11 AM)mechabit Wrote: I've switch to json saving and it works fine now.
Another question:
I see the ropes have a sleep threshold but no sleep event.
Saving OnDisable doesn't work.
Currently I'm just saving every couple seconds.
What's the best way to know if a rope is sleeping?
Ropes don't have a sleep threshold at all, and they don't sleep.
Solvers have a sleep threshold, individual particles in a solver sleep. In XPBD, sleep doesn't behave as in regular rigidbody engines: it's not a state in which an object is taken out of the simulation when it ceases to move. Instead, it is used to zero-out small changes in velocity, removing undesired drift/jitter without ever taking the particle out of the simulation as explained in the manual:
Quote:Sleep threshold
Any particle with a kinetic energy below this value will be freezed in place. This is useful when you don“t want minuscule variations in velocity or force to perturb an actor, making it look like its jittering or moving very slowly. Set it to zero if you want your particles' positions to be affected by any force that acts upon them, however small it may be.
Unlike asleep rigidbodies in most rigidbody engines, asleep particles are not taken out of the simulation and will not save performance. Their position is simply not updated.
If you want to know whether a rope is not moving, simply check the average or maximum velocity of all its particles using the particles API.

