Fixed crash and asserts when heightfield is used without Terrain World
Signed-off-by: Sergey Pereslavtsev <pereslav@amazon.com>
This commit is contained in:
@@ -694,7 +694,12 @@ namespace PhysX
|
||||
const float minYBounds = -(numRows * heightfieldShapeConfig.GetGridResolution().GetY()) / 2.0f;
|
||||
|
||||
auto heights = heightfieldShapeConfig.GetSamples();
|
||||
|
||||
|
||||
if (heights.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int xIndex = 0; xIndex < numColumns - 1; xIndex++)
|
||||
{
|
||||
for (int yIndex = 0; yIndex < numRows - 1; yIndex++)
|
||||
|
||||
@@ -211,7 +211,12 @@ namespace PhysX
|
||||
{
|
||||
ClearHeightfield();
|
||||
InitHeightfieldShapeConfiguration();
|
||||
InitStaticRigidBody();
|
||||
|
||||
if (!m_shapeConfig->GetSamples().empty())
|
||||
{
|
||||
InitStaticRigidBody();
|
||||
}
|
||||
|
||||
Physics::ColliderComponentEventBus::Event(GetEntityId(), &Physics::ColliderComponentEvents::OnColliderChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,13 @@ namespace PhysX
|
||||
{
|
||||
ClearHeightfield();
|
||||
InitHeightfieldShapeConfiguration();
|
||||
InitStaticRigidBody();
|
||||
|
||||
Physics::HeightfieldShapeConfiguration& configuration = static_cast<Physics::HeightfieldShapeConfiguration&>(*m_shapeConfig.second);
|
||||
if (!configuration.GetSamples().empty())
|
||||
{
|
||||
InitStaticRigidBody();
|
||||
}
|
||||
|
||||
Physics::ColliderComponentEventBus::Event(GetEntityId(), &Physics::ColliderComponentEvents::OnColliderChanged);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user