Two questions: Rolling back system and hard constraints

Armin Samii
Posts: 3
Joined: Tue Nov 01, 2011 9:55 pm

Two questions: Rolling back system and hard constraints

Post by Armin Samii »

Hi there,
I have two questions:

First, is it possible to "roll back" the state of the system so I can test two alternate paths and choose one? Specifically, I'd be doing this in btDynamicsWorld::internalSingleStepSimulation.
Is it as easy as calling integrateTransforms,updateActions,updateActivationState once with a regular timestep, and the second time with a timestep of 0? (This seems not right to me.)

Second, how can I create an extremely rigid point2point constraint? I have set the CFM to 0 and the ERP to .8, but the two rigidBodies still seem to be connected with a spring. I want the "restoration" force to push it exactly into place, rather than springing it towards the correct location.
(For example, ten connected blocks, each connected to a wall, should not have any visible gravity pull, whereas it currently oscillates.)


Forgive me if these are simple questions that have been answered (I couldn't find any recent answers). Feel free to link me to relevant threads.


Thanks,
Armin
Armin Samii
Posts: 3
Joined: Tue Nov 01, 2011 9:55 pm

Re: Two questions: Rolling back system and hard constraints

Post by Armin Samii »

I managed to roll back the system by saving the body positions, linear and angular velocities, and inEnabled() state of every constraint. This seems to work for my purposes. (I can post code if anyone likes, but it is fairly straightforward.)

It looks like there is some internal state of constraints that sometimes does get changed (aabb broadphase radii) but I don't save that and the system seems to roll back correctly.



-Armin
User avatar
jarno
Posts: 57
Joined: Tue Mar 16, 2010 1:42 am

Re: Two questions: Rolling back system and hard constraints

Post by jarno »

You also have to roll back the collisions if you are using persistent manifolds, and the overlapping pair cache if you want repeatability.

---JvdL---
Armin Samii
Posts: 3
Joined: Tue Nov 01, 2011 9:55 pm

Re: Two questions: Rolling back system and hard constraints

Post by Armin Samii »

jarno wrote:You also have to roll back the collisions if you are using persistent manifolds, and the overlapping pair cache if you want repeatability.

---JvdL---
Thank you!