Reverted computing point offsets in local space
Force is applied in world space, so contact points should also be in world space
This commit is contained in:
parent
2d2c8a1b20
commit
f7ea42f58e
|
@ -108,14 +108,13 @@ namespace SHADE
|
||||||
memcpy_s(newConstraint.tangents, TANGENTS_SIZE, manifold.tangents, TANGENTS_SIZE);
|
memcpy_s(newConstraint.tangents, TANGENTS_SIZE, manifold.tangents, TANGENTS_SIZE);
|
||||||
memcpy_s(newConstraint.contacts, CONTACTS_SIZE, manifold.contacts, CONTACTS_SIZE);
|
memcpy_s(newConstraint.contacts, CONTACTS_SIZE, manifold.contacts, CONTACTS_SIZE);
|
||||||
|
|
||||||
// Compute rA & rB for contacts with the local centroids
|
const SHCollisionUtils::ShapeTransform TF_A{ SHAPE_A->GetWorldCentroid(), SHAPE_A->GetWorldOrientation() };
|
||||||
const SHVec3 LOCAL_COM_A = BODY_A ? BODY_A->localCentroid : SHVec3::Zero;
|
const SHCollisionUtils::ShapeTransform TF_B{ SHAPE_B->GetWorldCentroid(), SHAPE_B->GetWorldOrientation() };
|
||||||
const SHVec3 LOCAL_COM_B = BODY_B ? BODY_B->localCentroid : SHVec3::Zero;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < newConstraint.numContacts; ++i)
|
for (uint32_t i = 0; i < newConstraint.numContacts; ++i)
|
||||||
{
|
{
|
||||||
newConstraint.contacts[i].rA = newConstraint.contacts[i].localPointA - LOCAL_COM_A;
|
newConstraint.contacts[i].rA = (TF_A * newConstraint.contacts[i].localPointA) - newConstraint.centerOfMassA;
|
||||||
newConstraint.contacts[i].rB = newConstraint.contacts[i].localPointB - LOCAL_COM_B;
|
newConstraint.contacts[i].rB = (TF_B * newConstraint.contacts[i].localPointB) - newConstraint.centerOfMassB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue