added safeguards

This commit is contained in:
NoriteSC
2023-10-01 16:47:33 +02:00
parent 0b3b32195a
commit 809b9e3a7a

View File

@@ -934,15 +934,22 @@ void DebugDraw::DrawAxisFromDirection(const Vector3& origin, const Vector3& dire
void DebugDraw::DrawDirection(const Vector3& origin, const Vector3& direction, const Color& color, float duration, bool depthTest)
{
auto dir = origin + direction;
if (dir.IsNanOrInfinity())
return;
DrawLine(origin, origin + direction, color, duration, depthTest);
}
void DebugDraw::DrawRay(const Vector3& origin, const Vector3& direction,const Color& color, float length, float duration, bool depthTest)
{
if (isnan(length) || isinf(length))
return;
DrawLine(origin, origin + (direction.GetNormalized() * length), color, duration, depthTest);
}
void DebugDraw::DrawRay(const Ray& ray,const Color& color, float length, float duration, bool depthTest)
{
if (isnan(length) || isinf(length))
return;
DrawLine(ray.Position, ray.Position + (ray.Direction.GetNormalized() * length), color, duration, depthTest);
}