Obi Official Forum

Full Version: Is there a way to pause simulation?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to pause/continue simulation for particluar ObiActor?

Currently, I use RemoteFromSolver to stop simulation and AddToSolver to restart simulation.
AddToSolver() just restart simulation from start by using mesh in the actor topology.

Is there a way to Pause simulation for a particular actor and then Continue so it will continue to simulate this actor?
After I pause actor I can move it or rotate. So after continue it will continue simulation by having new orientation. 

I was trying to recreate topology from simulated result after last RemoteFromSolver call.
It is working but mesh is already deformed during past simulation and is not looks like it should. 
Thanks.
(27-02-2019, 06:55 PM)mmortall Wrote: [ -> ]Is there a way to pause/continue simulation for particluar ObiActor?

Currently, I use RemoteFromSolver to stop simulation and AddToSolver to restart simulation.
AddToSolver() just restart simulation from start by using mesh in the actor topology.

Is there a way to Pause simulation for a particular actor and then Continue so it will continue to simulate this actor?
After I pause actor I can move it or rotate. So after continue it will continue simulation by having new orientation. 

I was trying to recreate topology from simulated result after last RemoteFromSolver call.
It is working but mesh is already deformed during past simulation and is not looks like it should. 
Thanks.

Short answer, no.

The simulation runs as a whole for each solver, there's no way to simulate some actors independently from others unless they use different solvers (and then you can just disable/enable each solver individually to pause/resume the simulation.) However by doing that, if you moved the actor around while paused, the particles would spring from their old positions to the new ones as if you had teleported the object suddenly while the solver "wasn't looking" (which is precisely what you'd done from a simulation standpoint).

However, since you have full access to all particle properties at runtime you can manipulate them in any way you need/want to achieve the effect you're after.

The way to do what you want is to set all the actor particles inverse masses and velocities to zero ("pause" their sim), manually set their positions/orientations (move them around while paused), then reset their inverse masses back to what they were before pausing.

http://obi.virtualmethodstudio.com/tutor...icles.html

cheers,
(27-02-2019, 09:14 PM)josemendez Wrote: [ -> ]Short answer, no.

The simulation runs as a whole for each solver, there's no way to simulate some actors independently from others unless they use different solvers (and then you can just disable/enable each solver individually to pause/resume the simulation.) However by doing that, if you moved the actor around while paused, the particles would spring from their old positions to the new ones as if you had teleported the object suddenly while the solver "wasn't looking" (which is precisely what you'd done from a simulation standpoint).

However, since you have full access to all particle properties at runtime you can manipulate them in any way you need/want to achieve the effect you're after.

The way to do what you want is to set all the actor particles inverse masses and velocities to zero ("pause" their sim), manually set their positions/orientations (move them around while paused), then reset their inverse masses back to what they were before pausing.

http://obi.virtualmethodstudio.com/tutor...icles.html

cheers,

Thanks for help. But if I change inverse masses and velocities to zero during simulation does it affect performance in some way? So I still have performance drop during "pause" because technically it will still simulate this item? Or no?
(28-02-2019, 02:39 PM)mmortall Wrote: [ -> ]Thanks for help. But if I change inverse masses and velocities to zero during simulation does it affect performance in some way? So I still have performance drop during "pause" because technically it will still simulate this item? Or no?

Technically, yes the object will still be simulated, unless you can disable the solver too (in case this is the only actor in the solver). The action of setting the masses and velocities does not affect performance, it is simply a loop doing some assignments.