17-07-2023, 09:38 AM
(This post was last modified: 17-07-2023, 10:59 AM by josemendez.)
(17-07-2023, 08:44 AM)danazoid Wrote: Did you mean lambda = constraint * ( invMassA + invMassB)?
which is consistent with PBD paper/slides and Obi code:
BurstContact.SolveAdhesion {
...
float dlambda = -constraint / TotalNormalInvMass;
...
}
Nope. Both the PBD paper and Obi's code divide by the total inverse mass. A / (1 / B) = A * B.
Still, constraint * (massA + massB) is not correct since 1/A + 1/B != 1/(A+B), should have said constraint / (1/massA + 1/mass B). My bad!
(17-07-2023, 08:44 AM)danazoid Wrote: =====
Then velocity of the rigidbody is calculated here?
BurstMath.ApplyImpulse {
...
linearDeltas[rigidbodyIndex] += rigidbodies[rigidbodyIndex].inverseMass * impulseWS;
...
}
That's a linear velocity delta, not the final velocity. linearDelta is then added to the rigidbody's linear velocity at the start of the frame. Same with the angular velocity.
(17-07-2023, 08:44 AM)danazoid Wrote: Then somehow Unity calculates something that interacts with the joint force.
Unity solves for impulses, same thing Obi does. You accumulate multiple impulses on a rigidbody (some come from Obi, some come from Unity joints), and end up with the final velocity.