# Spatial Mapping Problems

**URL:** <https://forums.unrealengine.com/t/spatial-mapping-problems/1336672>\
**Category:** Blueprint\
**Tags:** HoloLens-2, unreal-engine, Blueprint\
**Created:** [October 18, 2023, 1:01pm UTC](https://forums.unrealengine.com/t/spatial-mapping-problems/1336672 "2023-10-18T13:01:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mor1tz4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mor1tz4](https://forums.unrealengine.com/u/Mor1tz4)\
**Post date:** [October 18, 2023, 1:01pm UTC](https://forums.unrealengine.com/t/spatial-mapping-problems/1336672/1 "2023-10-18T13:01:00Z")

</div>

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:

> **[HoloLens 2 Mixed Reality Production for Unreal Engine | Course](https://dev.epicgames.com/community/learning/courses/M97/hololens-2-mixed-reality-production-for-unreal-engine/LBo/unreal-engine-spatial-mapping)**
>
> Learn how to develop mixed reality experiences on the HoloLens 2, from setup to submission, with Unreal Engine! Join Kevin Lyle as he provides comprehen...

> **[Spatial Mapping in Unreal - Mixed Reality](https://learn.microsoft.com/en-us/windows/mixed-reality/develop/unreal/unreal-spatial-mapping)**
>
> Learn how to use spatial mapping and meshes in Unreal mixed reality applications for HoloLens devices.

> **[Scene Understanding in Unreal - Mixed Reality](https://learn.microsoft.com/en-us/windows/mixed-reality/develop/unreal/unreal-scene-understanding)**
>
> Learn how to use scene understanding in Unreal mixed reality applications for HoloLens devices.

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.

---

<div class="post-metadata">

**Author:** ![yoponchik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yoponchik](https://forums.unrealengine.com/u/yoponchik)\
**Post date:** [July 8, 2024, 9:23am UTC](https://forums.unrealengine.com/t/spatial-mapping-problems/1336672/2 "2024-07-08T09:23:31Z")

</div>

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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/a/7/da7d88744de9834415768abc2982ed4923642f3b.png)

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

```auto
#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](https://learn.microsoft.com/en-us/windows/mixed-reality/develop/unreal/unreal-spatial-mapping)
