Optimize collider cached scale

This commit is contained in:
Wojtek Figat
2025-06-05 15:06:03 +02:00
parent ba75fd5882
commit f6feae5cf2
8 changed files with 17 additions and 23 deletions

View File

@@ -205,7 +205,7 @@ void Collider::CreateShape()
ASSERT(_shape == nullptr);
// Setup shape geometry
_cachedScale = GetScale();
_cachedScale = GetScale().GetAbsolute().MaxValue();
CollisionShape shape;
GetGeometry(shape);
@@ -222,7 +222,7 @@ void Collider::UpdateGeometry()
return;
// Setup shape geometry
_cachedScale = GetScale();
_cachedScale = GetScale().GetAbsolute().MaxValue();
CollisionShape shape;
GetGeometry(shape);
@@ -427,7 +427,7 @@ void Collider::OnTransformChanged()
}
}
const Float3 scale = GetScale();
const float scale = GetScale().GetAbsolute().MaxValue();
if (_cachedScale != scale)
UpdateGeometry();
UpdateBounds();