Spatial Mapping Problems

I am currently developing an Unreal Engine 5.0.3 application for the HoloLens2.
For this application, I need spatial mapping, but I can’t get that to work.

I tried the following tuturials:

In my version i have two UxtPressableButtonActors that when pressed activate the functions setVisibility and toggleARSeassion. But nothing I try actually works, and I can’t get the mesh to be visible.

I also implemented Scene Understanding and when I run the function it successfully calls the onAddTrackedGeometry or onUpdateTrackedGeometry, but it doesn’t recognice anything other than the World itself.

I know this is late, but just in case there are other people looking for a solution.
Try turning on the Spatial Mapping Mode like the image below.

If you’re doing this in C++, try this code

#include "ARBlueprintLibrary.h"
#include "MRMeshComponent.h"

void AARTrackableMonitor::BeginPlay()
{
    Super::BeginPlay();

    // Subscribe to Tracked Geometry delegates
    UARBlueprintLibrary::AddOnTrackableAddedDelegate_Handle(
        FOnTrackableAddedDelegate::CreateUObject(this, &AARTrackableMonitor::OnTrackableAdded)
    );
}

void AARTrackableMonitor::OnTrackableAdded(UARTrackedGeometry* Added)
{
    // When tracked geometry is received, check that its from spatial mapping
    if(Added->GetObjectClassification() == EARObjectClassification::World)
    {
        UMRMeshComponent* MRMesh = Added->GetUnderlyingMesh();
    }
}

For more info, go to Spatial Mapping in Unreal - Mixed Reality | Microsoft Learn

1 Like