First time after opening the level/compiling the project I get two warnings right after Play.
Ensure condition failed: NewTransform.IsValid() [File:E:/UE4_TrueSky_4.22/UnrealEngine-4.22/Engine/Source/Runtime/Engine/Private/Components/SceneComponent.cpp] [Line: 623]
[2020.03.09-17.45.18:951][544]LogOutputDevice: Error: Ensure condition failed: NewTransform.IsValid() [File:E:/UE4_TrueSky_4.22/UnrealEngine-4.22/Engine/Source/Runtime/Engine/Private/Components/SceneComponent.cpp] [Line: 623]
[2020.03.09-17.45.18:952][544]LogStats: FDebug::EnsureFailed - 0.001 s
UE4Editor.exe has triggered a breakpoint.
[2020.03.09-17.46.41:568][544]LogOutputDevice: Warning:
Script Stack (0 frames):
Ensure condition failed: !NewTransform.ContainsNaN() [File:E:/UE4_TrueSky_4.22/UnrealEngine-4.22/Engine/Source/Runtime/Engine/Private/PhysicsEngine/BodyInstance.cpp] [Line: 2037]
SetBodyTransform contains NaN (/Game/MyLevels/UEDPIE_0_TestLevel.TestLevel:PersistentLevel.BP_Hatch_yut1_GEN_VARIABLE_BP_Hatch_C_CAT_935.Box)
-nan(ind),-nan(ind),396.899048|0.006045,-160.000427,-0.006097|6.000000,6.000000,8.400001
[2020.03.09-17.46.41:568][544]LogOutputDevice: Error: Ensure condition failed: !NewTransform.ContainsNaN() [File:E:/UE4_TrueSky_4.22/UnrealEngine-4.22/Engine/Source/Runtime/Engine/Private/PhysicsEngine/BodyInstance.cpp] [Line: 2037]
SetBodyTransform contains NaN (/Game/MyLevels/UEDPIE_0_TestLevel.TestLevel:PersistentLevel.BP_Hatch_yut1_GEN_VARIABLE_BP_Hatch_C_CAT_935.Box)
-nan(ind),-nan(ind),396.899048|0.006045,-160.000427,-0.006097|6.000000,6.000000,8.400001
The hatch which is being mentioned here is a blueprint class attached to the ship blueprint class. There are few such a hatches and they are all identical.
Hatch blueprint (nothing in event graph):
Hatch blueprint is a child of C++ class AHatch.
.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Hatch.generated.h"
UCLASS()
class ALMAZ_API AHatch : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AHatch();
//class UBoxComponent* boxTriggerVolume;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
//UFUNCTION()
//void BeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
void openHatch();
};
.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#define printFString(text, fstring) if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT(text), fstring))
#include "Hatch.h"
//#include "Components/BoxComponent.h"
#include "Engine/Engine.h"
// Sets default values
AHatch::AHatch()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
//boxTriggerVolume = CreateDefaultSubobject<UBoxComponent>(TEXT("Box Trigger"));
//boxTriggerVolume->InitBoxExtent(FVector(100.f));
//boxTriggerVolume->SetCollisionProfileName(TEXT("Trigger"));
//RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Scene Root"));
//boxTriggerVolume->SetupAttachment(RootComponent, NAME_None);
//boxTriggerVolume->SetGenerateOverlapEvents(true);
}
void AHatch::openHatch()
{
printFString("Hatch: openHatch function called", nullptr);
}
void AHatch::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AHatch::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
Ship blueprint is a child of C++ class AShip.
.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "Ship.generated.h"
UCLASS()
class ALMAZ_API AShip : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
AShip();
UPROPERTY()
TArray<class USplash*> splashComponents;
UPROPERTY()
TArray<class UTrueSkyWaterBuoyancyComponent*> waterComponents;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
};
.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "Ship.h"
#include "Splash.h"
#include "TrueSkyWaterBuoyancyComponent.h"
// Sets default values
AShip::AShip()
{
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void AShip::BeginPlay()
{
Super::BeginPlay();
FHitResult outHit;
FCollisionQueryParams collisionParams;
this->GetComponents(waterComponents);
FVector center = GetActorLocation();
center.Z -= 200.f;
FVector prevSplashLocation(0.f, 0.f, 0.f);
for (double a = 0.0; a < 2 * PI; a += 2 * PI / 128) // devide circle on 128 parts
{
FVector end_vector;
end_vector.X = 4000.f * cos(a);
end_vector.Y = 4000.f * sin(a);
end_vector.Z = center.Z;
if (GetWorld()->LineTraceSingleByChannel(outHit, end_vector, center, ECC_Visibility, collisionParams))
{
if (FVector::Dist(prevSplashLocation, outHit.Location) > 300.f)
{
USplash* currentSplash = NewObject<USplash>(this);
// Make sure the probes won't affect the ship physics and won't create waves
currentSplash->ProbeType = EProbeType::Source;
currentSplash->GenerateWaves = false;
currentSplash->Intensity = 0.f;
currentSplash->RegisterComponent();
currentSplash->SetWorldLocationAndRotation(outHit.Location, FRotator::ZeroRotator);
// saving vector of a normal relative to respective USplash instance
currentSplash->splashNormalLocal = outHit.Normal * 100.f - currentSplash->GetComponentLocation().Normalize();
currentSplash->AttachToComponent(waterComponents[0], FAttachmentTransformRules::KeepWorldTransform, NAME_None);
prevSplashLocation = outHit.Location;
}
/* if (a <= PI)
{
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, FString::Printf(TEXT("You hit %s"), *outHit.Location.ToString()));
new_splash->setRightSided(true);
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Blue, FString::Printf(TEXT("You hit %s"), *outHit.Location.ToString()));
new_splash->setRightSided(false);
}
splashComponents.Add(new_splash); */
}
}
}
// Called every frame
void AShip::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void AShip::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
After these two breakpoints game continues but the ship is gone. I would be grateful if someone could point me to the right direction. Have never encountered ‘not a number’ (NaN) issue.


