Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Obi Solver simulation in Physics.simulate
#2
(29-09-2018, 10:18 AM)suapys Wrote: Hi there.

I'm working the obi rope in my game, and I got a few questions about obi rope in Physics.Simulation.

The Physics.Simulation is a function to simulation the physics state of objects when the automatic simulation is turned off.
But seems like if I turn off the automatic simulation in Unity, the Update() function in Obi Solver will not be called.
And the Obi rope will not update the physics state either.

Is there any way to Update the Obi Solver when the automatic simulation is turned off? Huh

Hi,

If you turn off automatic simulation entirely, you might need to update Obi manually using the following functions. Note this is not officially supported and you might easily run into synchronization problems between regular rigidbodies and Obi.

This function will accumulate game time, used for interpolating physics states. Normally you would call this in Update().
Code:
solver.AccumulateSimulationTime(deltaTime)

This one will perform one simulation step (call it as many times as needed per frame). Usually called in FixedUpdate().
Code:
solver.SimulateStep(fixedDeltaTime)

This one signals the end of a frame (performs state interpolation, updates solver visibility, etc). Usually called in LateUpdate().
Code:
solver.EndFrame(fixedDeltaTime);

Note that the Unity docs state that both Update() and FixedUpdate() are still called when automatic simulation is disabled, and we did not run into the issue you describe. Turning off auto simulation does allow Obi to continue perfoming its simulation.
Reply


Messages In This Thread
RE: Obi Solver simulation in Physics.simulate - by josemendez - 29-09-2018, 03:18 PM