Skip to content

Commit f5ff12d

Browse files
committed
Fix testSphereAgainstWorld as well
1 parent e165f6d commit f5ff12d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Client/game_sa/CWorldSA.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,9 +539,18 @@ CEntity* CWorldSA::TestSphereAgainstWorld(const CVector& sphereCenter, float rad
539539
return nullptr;
540540

541541
result.collisionDetected = true;
542-
result.modelID = entity->m_nModelIndex;
543-
result.entityPosition = entity->matrix->vPos;
544-
ConvertMatrixToEulerAngles(*entity->matrix, result.entityRotation.fX, result.entityRotation.fY, result.entityRotation.fZ);
542+
result.modelID = entity->m_nModelIndex;
543+
if (entity->matrix)
544+
{
545+
result.entityPosition = entity->matrix->vPos;
546+
ConvertMatrixToEulerAngles(*entity->matrix, result.entityRotation.fX, result.entityRotation.fY, result.entityRotation.fZ);
547+
}
548+
else
549+
{
550+
result.entityPosition = entity->m_transform.m_translate;
551+
result.entityRotation.fX = result.entityRotation.fY = 0.0f;
552+
result.entityRotation.fZ = entity->m_transform.m_heading;
553+
}
545554
result.entityRotation = -result.entityRotation;
546555
result.lodID = entity->m_pLod ? entity->m_pLod->m_nModelIndex : 0;
547556
result.type = static_cast<eEntityType>(entity->nType);

0 commit comments

Comments
 (0)