17-06-2019, 07:18 PM
(17-06-2019, 02:49 PM)jabza Wrote: I'm currently moving the parent object of the Solver in LateUpdate, and I've set the script performing the action as the last to run in theĀ 'script execution order' list.
For context, this is a floating origin implementation I'm using. Any ideas?
Thanks again.
Hi there,
You should move your ship *before* the physics update for the solver happens, or a 1-frame delay will be introduced. The solver has lots of events for you to hook up custom code to. You should probably use solver.OnStepBegin, that is called right before each physics step. However, this alone won't help with teleporting.
Take a look at the ObiActorTeleport.cs script. (found in Obi/SampleScenes/SampleResources/Scripts). To teleport an actor, you should:
-disable it.
-teleport it.
-wait for the next FixedUpdate and re-enable it.
Carefully scheduling the order in which things should happen each frame is of vital importance when working with physics, as it is easy to introduce jitter/lags if using an incorrect setup.