12-04-2018, 08:20 PM
(This post was last modified: 12-04-2018, 08:24 PM by josemendez.)
(12-04-2018, 06:54 PM)NightFox Wrote: Okay, thanks!
I'm reduce Unity's max fixed timestep instead and get the same as LateUpdate (ClothStaticMeshCollider demo).
However, on the Intercollisions demo I noticed a difference.
With late update I get physics glitches (when "Simulate when invisible" is disabled and I turn the camera), but with FixedUpdate there is no problem (with similar performance). May be someone will be useful.
Are there any script examples? What functions/api should I call?
I was able to reduce artifacts change settings:
1. for solver: Damping 0.5, Particle Collision Iterations 9 (parallel mode) Relaxation 1
2. for cloth: Distance Constraints Slack 0.3
I think we can finding compromise without a significant loss of performance (sacrificing some plausibility).
When using LateUpdate and turning the camera away then back to the cloth, the use of variable timestep causes the first timestep to be too long (since a long time has passed since the last update, when the solver was visible).
This cannot be avoided in the general case, as it is inherent to using LateUpdate to update physics, which should never be done without a good reason anyway as the results are highly unphysical (refer to the official Unity docs for more info on why physics belong in FixedUpdate). As a hack, you could clamp the timestep to a maximum value (I will post the modification if you need it). Physics should always be updated in FixedUpdate, if you do otherwise make sure you know why you're doing it. The LateUpdate mode is provided only for edge cases and special uses.
Regarding the API for getting/setting particle properties and code snippets, take a look at the docs:
http://obi.virtualmethodstudio.com/tutor...icles.html