HPL1: Add workaround for helmet collider

This commit is contained in:
grisenti 2023-09-21 23:05:17 +02:00
parent d7765997d5
commit 80d525e665

6
engines/hpl1/engine/graphics/Mesh.cpp Normal file → Executable file
View file

@ -693,6 +693,12 @@ int cMesh::GetColliderNum() {
}
iCollideShape *cMesh::CreateCollideShapeFromCollider(cMeshCollider *pCollider, iPhysicsWorld *apWorld) {
// WORKAROUND: Bug #14570: "HPL1: helmet stuck inside a locker"
// Collider creation and updating changed between the version of the Newton physics library we are using and the original version. The changes are probably in dgBody::UpdateCollisionMatrix
// (or in one of the functions called inside of it), called when at the creation of the helmet's PhysicsBodyNewton and after modifying the body's transformation matrix later in the loading process.
if (GetName() == "iron_mine_helmet.dae") {
return apWorld->CreateBoxShape(pCollider->mvSize - cVector3f(0.04, 0.0, 0.04), &pCollider->m_mtxOffset);
}
switch (pCollider->mType) {
case eCollideShapeType_Box:
return apWorld->CreateBoxShape(pCollider->mvSize, &pCollider->m_mtxOffset);