making both colliders and shape colliders check m_simulating in IsPhysicsEnabled

This commit is contained in:
greerdv
2021-05-11 16:57:23 +01:00
parent 8e90e87bc8
commit dff8de94a5
2 changed files with 16 additions and 2 deletions
@@ -1057,7 +1057,14 @@ namespace PhysX
bool EditorColliderComponent::IsPhysicsEnabled() const
{
return m_editorBodyHandle != AzPhysics::InvalidSimulatedBodyHandle;
if (m_sceneInterface && m_editorBodyHandle != AzPhysics::InvalidSimulatedBodyHandle)
{
if (auto* body = m_sceneInterface->GetSimulatedBodyFromHandle(m_editorSceneHandle, m_editorBodyHandle))
{
return body->m_simulating;
}
}
return false;
}
AZ::Aabb EditorColliderComponent::GetAabb() const
@@ -752,7 +752,14 @@ namespace PhysX
bool EditorShapeColliderComponent::IsPhysicsEnabled() const
{
return m_editorBodyHandle != AzPhysics::InvalidSimulatedBodyHandle;
if (m_sceneInterface && m_editorBodyHandle != AzPhysics::InvalidSimulatedBodyHandle)
{
if (auto* body = m_sceneInterface->GetSimulatedBodyFromHandle(m_editorSceneHandle, m_editorBodyHandle))
{
return body->m_simulating;
}
}
return false;
}
AZ::Aabb EditorShapeColliderComponent::GetAabb() const