Interpolated transform and constraint satisfaction

Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

Erwin,

I have a short question regarding this. Let's assume the fps is lower then your internal timestep. Therefore Bullet will only interpolate the system instead of performing a simulation step. Now assume I move some kinematic actors during this frame, where most of these actors are attached to dynamic actors via some joint chain. How does Bullet account for this? And note that it is vital that the target postion is met in this specific frame and not delayed until the next simulation step. Gameplay always rules...

-Dirk
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Dirk Gregorius wrote:Erwin,

I have a short question regarding this. Let's assume the fps is lower then your internal timestep. Therefore Bullet will only interpolate the system instead of performing a simulation step. Now assume I move some kinematic actors during this frame, where most of these actors are attached to dynamic actors via some joint chain. How does Bullet account for this? And note that it is vital that the target postion is met in this specific frame and not delayed until the next simulation step. Gameplay always rules...

-Dirk
Hi Dirk,

Bullet accounts for this indeed, the kinematic actors velocity is calculated and saved during the simulation step, just like other velocities. The interpolation takes these 'interpolatedLinearVelocity', 'interpolatedAngularVelocity'. See

Code: Select all

void    btDiscreteDynamicsWorld::saveKinematicState(float timeStep)
Also, you can still apply impulses during the interpolated simulation steps. See the BulletC4Demo with bullet time: run the demo, bring up the console, type pbullettime 0.01 and shoot at the tower blocks. The applied impulse immediately effects the linear/angular velocity, but the interpolation uses the saved interpolated velocities.

Erwin
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

but the interpolation uses the saved interpolated velocities.
This way you can guarentee that I will meet my target position 100% ?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Dirk Gregorius wrote:
but the interpolation uses the saved interpolated velocities.
This way you can guarentee that I will meet my target position 100% ?
This interpolation scheme assumes constant linear and angular velocities. If your constraint (to the kinematic actor) is satisfied in both fixed timestep T0, and fixed timestep T1, why would the interpolated transforms between T0 and T1 violate the constraints?

By the way:
Let's assume the fps is lower then your internal timestep.
Isn't this a typo? FPS = 1 / deltaTime, so you mean the real deltaTime is lower then the internal timestep?
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

If your constraint (to the kinematic actor) is satisfied in both fixed timestep T0, and fixed timestep T1, why would the interpolated transforms between T0 and T1 violate the constraints?
Let's assume we have a character with a hinge chain connected to him. Now I rotate the character and the character is drawn in this configuration in this particular frame. This will break you solution at T1 of course. You can't guarentee that the position I enforce from the outside matches your interpolated configuretion. How should this be possible?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Dirk Gregorius wrote:
If your constraint (to the kinematic actor) is satisfied in both fixed timestep T0, and fixed timestep T1, why would the interpolated transforms between T0 and T1 violate the constraints?
Let's assume we have a character with a hinge chain connected to him. Now I rotate the character and the character is drawn in this configuration in this particular frame. This will break you solution at T1 of course. You can't guarentee that the position I enforce from the outside matches your interpolated configuretion. How should this be possible?
User interaction, penetration resolving and other discontinuities should be delayed until the next simulation step. This is what happens with impulses at the moment. Discontinuities applied in-between T0 and T1 are not handled by a discrete simulation + interpolation. A future btContinuousDynamicsWorld might handle discontinuities as you describe, but the discrete dynamics world needs to delay them.

Note that we are talking about 60 hertz fixed timestep, so I would be surprised that delaying user interactions for 0.016 seconds would be an issue.

Erwin
Cleanrock
Posts: 7
Joined: Tue May 01, 2007 6:23 pm

Post by Cleanrock »

Erwin Coumans wrote: Also, you can still apply impulses during the interpolated simulation steps. See the demo (link not allowed in first post): run the demo, bring up the console, type pbullettime 0.01 and shoot at the tower blocks. The applied impulse immediately effects the linear/angular velocity, but the interpolation uses the saved interpolated velocities.
Erwin
Hi,
I tested the C4 demo v0.6 (Bullet_2.23_C4_129_Demo.zip) to see if impulses actually effects linear/angular velocity immediately and from what i see that is not the case.

I investigated this because i have some problems (graphics jittering) with interpolation on my controlled rigidbody (player view) which i have set a high damping factor (0.9) on, it seem interpolation do not take damping into consideration. This can be seen very easily if u use a high time step, the effect is that the object jumps back when a simulation time step is performed.

I am pretty new to bullet so i might be out on a very thin branch here.
Since this is my first post here I would like to say I appreciate the bullet project very much.

Johan "Cleanrock" Rehnberg