other be stable with only 10 iterations. This is with a erp = 0.2 * fps (fps = 60). I have started
to experiment with splitting the penetration depth correction impulses and I'm not getting good results.
The simulation becomes very jittery with the cubes tilting back and forth and settling into each other.
The instability seems to be coming from the angular movement. Has anyone experienced these kinds of
problems with 3D split impulses. Bullet doesn't use split impulses, is this just not implemented or
was it found to be problematic? I'm going to post my pseudo code below if anyone notices a problem.
PreImpulse:
Code: Select all
bias_normal_lambda = 0.0;
B = depth - DEPTH_SLOP;
B = B < 0.0 ? 0.0 : B;
P = J * accumulated_normal_lambda
apply P
Code: Select all
V = non-bias-velocity of both bodies
lambda = K^-1 * (-( J * v))
old_lambda = accumulated_normal_lambda
accumulated_normal_lambda += lambda
accumulated_normal_lambda = accumulated_normal_lambda < 0.0 ? 0.0 : accumulated_normal_lambda
lambda = accumulated_normal_lambda - old_lambda
P = J * lambda
apply P to non-bias velocity
V = bias-velocity of both bodies
bias_lambda = K^-1 * (-(J * V) + erp * B)
old_bias_lambda = bias_normal_lambda
bias_normal_lambda += bias_lambda
bias_normal_lambda = bias_normal_lambda < 0.0 ? 0.0 : bias_normal_lambda
bias_lambda = bias_normal_lambda - old_bias_lambda
P = J * bias_lambda
apply P to bias velocity
Code: Select all
lv = linear_velocity + bias_linear_velocity
av = angular_velocity + bias_angular_velocity
...
bias_linear_velocity = 0.0
bias_angular_velocity = 0.0