14-01-2022, 10:10 AM
(This post was last modified: 14-01-2022, 10:11 AM by josemendez.)
(14-01-2022, 09:52 AM)lufydad Wrote: To rephrase my question :
How can I disable physics calculation on a given obi solver while keeping the obi solver updating the positions of the rope when we set them from script ?
Code:_obiSolver0.positions[i] = pos
Hi!
What you need in this case is for the renderers to keep updating the rope mesh as if the solver was being updated, but without updating the solver. This means taking control of the update cycle.
You can inherit from ObiUpdater to write your own updater component for this, or slightly modify one of the existing ones to add a "simulate" boolean flag. While this flag is inactive, call updater.Interpolate() but don't call BeginStep(), Substep() or EndStep(). This will trigger rendering updates as if the simulation was running.
Note that you can also deactivate simulation on a per-particle basis, by setting the particle inverse mass to 0 (see http://obi.virtualmethodstudio.com/manua...icles.html):
Quote:Inverse mass for each particle. An inverse mass of 0 means the particle's mass is infinite, so its position will be unaffected by dynamics (allowing you to override it manually).
If you do this for all particles in a solver, most housekeeping stuff (updating internal spatial structures, updating constraints) will still be performed, so the performance gains are negligible compared to not updating the entire solver.