26-09-2020, 02:53 PM
(This post was last modified: 26-09-2020, 03:01 PM by josemendez.)
(26-09-2020, 01:28 AM)dasbin Wrote: Is this expected behaviour?
I lerp Unity's Timescale over a couple seconds fairly often (when the player changes rooms and the camera is moving, I slow down time).
During this time, any rope that is otherwise just hanging out will curl up and twitch around, then relax again when timescale goes back to 1.
I am not substepping at all.
As per Unity recommendation (https://docs.unity3d.com/ScriptReference...Scale.html), I am changing both timescale and modifying Time.fixedDeltaTime at the same time. My understanding is that omitting the fixedDeltaTime change will cause unpredictable behaviour for anything that happens to read the fixedDeltaTime on the same frame as a timeScale change (which is likely to happen given that timeScale is being lerped over several seconds), so that doesn't seem to be an option - though it does fix the rope's behaviour.
Yes, this is somewhat expected behavior: if you reduce the timestep, rope physics will suddenly be much snappier. Not sure about the "curling up" though, that sounds odd: make sure you've not attached the rope inside a collider that's also set up to collide with it (this is a very common mistake that will result in all sorts of weird behavior).
Changing the timestep size of any iterative engine will have a large effect on convergence. In PhysX (Unity) this isn't too noticeable as there's usually few constraints aside from contacts, but in Obi it is really noticeable because there's lots of constraints.
Try leaving Time.fixedDeltaTime alone, only set the timescale. Also make sure your ObiSolver has interpolation enabled to ensure smooth movement when the timestep size is reduced. See the "RopeAndJoints" sample scene, as it also slows down time at runtime.