UE5 Cesium demo / Flight Tracker not right,who can help me?

Hello everyone, just look at image! The lines is not right ,does anyone know?



PlaneTrack.cpp:

// Copyright 2020-2021 CesiumGS, Inc. and Contributors


#include "PlaneTrack.h"

// Sets default values
APlaneTrack::APlaneTrack()
{
 	// 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;

	// Initialize the track
	SplineTrack = CreateDefaultSubobject<USplineComponent>(TEXT("SplineTrack"));
	// This lets us visualize the spline in Play mode
	SplineTrack->SetDrawDebug(true);
	// Set the color of the spline
	SplineTrack->SetUnselectedSplineSegmentColor(FLinearColor(1.f, 0.f, 0.f));
}

// Called when the game starts or when spawned
void APlaneTrack::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void APlaneTrack::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

}
void APlaneTrack::LoadSplineTrackPoints()
{
    if (this->AircraftsRawDataTable != nullptr && this->CesiumGeoreference != nullptr)
    {
        int32 PointIndex = 0;
        for (auto& row : this->AircraftsRawDataTable->GetRowMap())
        {
            FAircraftRawData* Point = (FAircraftRawData*)row.Value;
            // Get row data point in lat/long/alt and transform it into UE4 points
            double PointLatitude = Point->latitude;
            double PointLongitude = Point->longitude;
            double PointHeight = Point->height;

            // Compute the position in UE coordinates
            glm::dvec3 UECoords = this->CesiumGeoreference->TransformLongitudeLatitudeHeightToUnreal(glm::dvec3(PointLongitude, PointLatitude, PointHeight));
            FVector SplinePointPosition = FVector(UECoords.x, UECoords.y, UECoords.z);
            this->SplineTrack->AddSplinePointAtIndex(SplinePointPosition, PointIndex, ESplineCoordinateSpace::World, false);

            // Get the up vector at the position to orient the aircraft
            const CesiumGeospatial::Ellipsoid& Ellipsoid = CesiumGeospatial::Ellipsoid::WGS84;
            glm::dvec3 upVector = Ellipsoid.geodeticSurfaceNormal(CesiumGeospatial::Cartographic(FMath::DegreesToRadians(PointLongitude), FMath::DegreesToRadians(PointLatitude), FMath::DegreesToRadians(PointHeight)));

            // Compute the up vector at each point to correctly orient the plane
            glm::dvec4 ecefUp(upVector, 0.0);
            const GeoTransforms& geoTransforms = this->CesiumGeoreference->GetGeoTransforms();
            const glm::dmat4& ecefToUnreal = geoTransforms.GetEllipsoidCenteredToAbsoluteUnrealWorldTransform();
            glm::dvec4 unrealUp = ecefToUnreal * ecefUp;
            this->SplineTrack->SetUpVectorAtSplinePoint(PointIndex, FVector(unrealUp.x, unrealUp.y, unrealUp.z), ESplineCoordinateSpace::World, false);

            PointIndex++;
        }
        this->SplineTrack->UpdateSpline();
    }
}

PlaneTrack.h:

// Copyright 2020-2021 CesiumGS, Inc. and Contributors

#pragma once

#include "Components/SplineComponent.h"
#include "CesiumGeoreference.h"
#include "Engine/DataTable.h"

#include <glm/vec3.hpp>
#include "CesiumGeospatial/Ellipsoid.h"
#include "CesiumGeospatial/Cartographic.h"

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "PlaneTrack.generated.h"
// Add import paths. Make sure they go above the PlaneTrack.generated.h line

USTRUCT(BlueprintType)
struct FAircraftRawData : public FTableRowBase
{
	GENERATED_USTRUCT_BODY()

public:
	FAircraftRawData()
		: longitude(0.0)
		, latitude(0.0)
		, height(0.0)
	{}

	UPROPERTY(EditAnywhere, Category = "FlightTracker")
		double longitude;
	UPROPERTY(EditAnywhere, Category = "FlightTracker")
		double latitude;
	UPROPERTY(EditAnywhere, Category = "FlightTracker")
		double height;
};



UCLASS()
class CESIUMFORUNREALSAMPLES_API APlaneTrack : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	APlaneTrack();
	// Function to parse the data table and create the spline track
	UFUNCTION(BlueprintCallable, Category = "FlightTracker")
		void LoadSplineTrackPoints();
	// Spline variable to represent the plane track
	UPROPERTY(BlueprintReadOnly, Category = "FlightTracker")
		USplineComponent* SplineTrack;

	// Cesium class that contain many useful  coordinate conversion functions
	UPROPERTY(EditAnywhere, Category = "FlightTracker")
		ACesiumGeoreference* CesiumGeoreference;

	// An Unreal Engine data table to store the raw flight data
	UPROPERTY(EditAnywhere, Category = "FlightTracker")
		UDataTable* AircraftsRawDataTable;

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

};

the csv data is right ,download from https://cesiumjs.s3.amazonaws.com/downloads/SFO_to_CPH_flight_data_WGS84.csv

Hi @dailiwei,

The flight tracker project hasn’t been tested in UE5. Have you tried the project in UE4?

I’ll try to take a look at it when I get a chance and figure out if there’s something causing this issue from UE5.

When I run compile on UE 4.27 and visual studio I get an error message

#include “CesiumGeoreference.h”

#include <glm/vec3.hpp>
#include “CesiumGeospatial/Ellipsoid.h”
#include “CesiumGeospatial/Cartographic.h” all not found

1 Like

Is the Cesium for Unreal plugin installed in UE 4.27? That error message suggests it might not be.

Hi! Did you get a chance to test the project in UE5? We´re about to start a project based on this functionality and wanted to know of there is anything in particular we should look out for.

We’re in the process of updating all the tutorials for the latest versions of UE. But as far as we know, aside from minor UI differences, the Flight Tracker tutorial should work in UE5. Do let us know if you run into problems, though.

1 Like

I am having the exact same problem with UE5. I cannot get past it
I will download 4.25 and 4.27 and test