21-02-2020, 01:36 PM
(This post was last modified: 21-02-2020, 01:38 PM by josemendez.)
(21-02-2020, 12:15 PM)TheMunk Wrote: That's fine - right now its not breaking anything important so I can live with it for now.
I was thinking more about the earlier comment:
Do you have any recommendations for increasing performance/simulation other than simulation?
More specifically; is there any way to disable the solver ones all actors have entered sleep mode? Since in my app only playerinput (or narratively scripted event) will re-awaken the rope.
My current solution is to have each rope in a single solver, and then manually disabling and enabling the solver - this way I save a ton of performance because I'm only simulating the ropes I need to, but they are all still being rendered. I can't seem to find a function for checking if the rope has reached it's sleep thresh-hold. This way I could make sure the rope is not moving when I disable the solver.
A sleep threshold is basically low kinetic energy. Kinetic energy of a body is defined as: 1/2 * mass * velocity^2. If that value is lower than a threshold for all particles, you know the rope isnt moving. Since you’re only interested in visual movement (not energy) you can drop the mass term:
1/2 * velocity^2.
The 1/2 is just a constant, that you can fold it over to the threshold value. Also the square.
So it all boils down to iterating over all particles in the rope and checking if their velocity is smaller than a threshold. If it is, you can disable the solver. If you find a single particle whose velocity is over the threshold, you must keep the solver enabled, so in most cases it’s an early out.