# Modify NavMeshBoundsVolume in C++

**URL:** <https://forums.unrealengine.com/t/modify-navmeshboundsvolume-in-c/393964>\
**Category:** C++\
**Tags:** navigation-mesh, navmeshbounds, unreal-engine, CPP, question\
**Created:** [May 18, 2017, 5:08pm UTC](https://forums.unrealengine.com/t/modify-navmeshboundsvolume-in-c/393964 "2017-05-18T17:08:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_d30a4989](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d30a4989](https://forums.unrealengine.com/u/anonymous_user_d30a4989)\
**Post date:** [May 18, 2017, 5:08pm UTC](https://forums.unrealengine.com/t/modify-navmeshboundsvolume-in-c/393964/1 "2017-05-18T17:08:01Z")

</div>

Hey guys,

I’ve got actors in my scene (spawned via C++) and I want to attach and modify NavMeshBoundsVolumes to them (also via C++).

```
 FActorSpawnParameters SpawnInfo;
 NaviMesh = GetWorld()->SpawnActor<ANavMeshBoundsVolume>(Super::GetActorLocation(), Super::GetActorRotation(), SpawnInfo);

```

Albeit the NavMesh is added to my scene, some problems occured in my attempts so far:

- Mobility  
I’m not able to attach my static NavMesh to my movable Actor. How can I change its mobility? (SetMobility() doesn’t work). Currently I connect the NavMeshs via pointer to my actor class, but I bet there is a more elegant way 🙂
- Brush Shape  
The default brush shape of my spawned NavMesh is “None”, however I want the box shape (via CubeBuilder) to girdle my actor object. How can I change it via code?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Nachtmahr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nachtmahr](https://forums.unrealengine.com/u/Nachtmahr)\
**Post date:** [May 18, 2017, 8:57pm UTC](https://forums.unrealengine.com/t/modify-navmeshboundsvolume-in-c/393964/2 "2017-05-18T20:57:10Z")

</div>

See those two Answers:

> **[Spawn a navmesh volume with blueprint](https://forums.unrealengine.com/questions/150163/spawn-a-navmesh-volume-with-blueprint.html)**
>
> I’m trying to create a navmesh volume from blueprint. So far i tried to spawn the volume with SpawnActor, but i should be missing some points as i can’t figure it out how to make that work (i tried with BSP for testing purpose : it does not work...

> **[How to build navmesh for dynamically sized procedural level](https://forums.unrealengine.com/questions/81497/how-to-build-navmesh-for-dynamically-sized-procedu.html)**
>
> I'm building a level generator that makes levels of a generally rectangular shape, but of a dynamic size along the X & Y axes. I have a blueprint that scales the navmesh volume actor in the X & Y so that it encompasses the walkable ground...

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d30a4989](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d30a4989](https://forums.unrealengine.com/u/anonymous_user_d30a4989)\
**Post date:** [May 19, 2017, 11:36am UTC](https://forums.unrealengine.com/t/modify-navmeshboundsvolume-in-c/393964/3 "2017-05-19T11:36:55Z")

</div>

Thanks! Helped me a lot.  
Nevertheless another problem - I’d like to attach my NavMesh to my actor (a spaceship). If I spawn the NavMesh in the spaceship constructor UE4 craches. Is it generally unlogical to attach a NavMesh to an actor? Seems to be programmed as an indepedent object in my level as MieszkoZ wrote in his answers.  
My workflow so far will be to spawn the NavMesh during level load, independent from spaceship pawn.

---

<div class="post-metadata">

**Author:** ![Nachtmahr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nachtmahr](https://forums.unrealengine.com/u/Nachtmahr)\
**Post date:** [May 19, 2017, 11:22pm UTC](https://forums.unrealengine.com/t/modify-navmeshboundsvolume-in-c/393964/4 "2017-05-19T23:22:42Z")

</div>

To be Honest I dont know why you would ever need to attach a Navmesh to anything. If you just want to create a Navmesh around a Actor use Recast navmesh. Like showcased in the Deer Ai inside the Kite Demo take a look here: [Creating the Open World Kite Real-Time Demo in UE4 | GDC 2015 Event Coverage | Unreal Engine - YouTube](https://youtu.be/clakekAHQx0?t=2207)
