fix gizmo drawing issue happens due to a null world object

This commit is contained in:
Mamadou Babaei
2023-04-28 01:19:54 +02:00
parent 66aec3cdea
commit 51e1d5f252
3 changed files with 8 additions and 9 deletions
@@ -36,24 +36,20 @@
#include "SGDebug/SGDebugGizmo.h"
#include "DrawDebugHelpers.h"
#include "Engine/Engine.h"
#include "Kismet/GameplayStatics.h"
#include "Math/Color.h"
#include "Math/Rotator.h"
#include "Math/Vector.h"
#include "SGLog/SGLog.h"
void FSGDebugGizmo::Draw(
const UWorld* World,
const FVector& Location, const FRotator& Rotation,
const float Length, const float Thickness,
const FColor& XAxisColor, const FColor& YAxisColor, const FColor& ZAxisColor,
const bool bPersistentLines, const float LifeTimeModifier, const uint8 DepthPriority)
{
if (!GEngine)
{
return;
}
const UWorld* World{GEngine->GetWorld()};
const float LifeTime = UGameplayStatics::GetWorldDeltaSeconds(World) * LifeTimeModifier;
const FVector XAxisLineEnd(Location + Rotation.RotateVector(FVector(Length, 0.0f, 0.0f)));
@@ -39,6 +39,7 @@ class SENSEGLOVEDEBUG_API FSGDebugGizmo final
{
public:
static void Draw(
const UWorld* World,
const FVector& Location, const FRotator& Rotation,
float Length = 1.0f,
float Thickness = 1.0f,