# Destructible Components always effect nav mesh even when collision disabled

**URL:** <https://forums.unrealengine.com/t/destructible-components-always-effect-nav-mesh-even-when-collision-disabled/343308>\
**Category:** World Creation\
**Tags:** Navigation, dynamic-navmesh, unreal-engine, Destructible-Mesh, Collision, question\
**Created:** [January 6, 2016, 7:42pm UTC](https://forums.unrealengine.com/t/destructible-components-always-effect-nav-mesh-even-when-collision-disabled/343308 "2016-01-06T19:42:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyesiah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eyesiah](https://forums.unrealengine.com/u/eyesiah)\
**Post date:** [January 6, 2016, 7:42pm UTC](https://forums.unrealengine.com/t/destructible-components-always-effect-nav-mesh-even-when-collision-disabled/343308/1 "2016-01-06T19:42:22Z")

</div>

1. Create a class that derives from DestructibleComponent and apply my suggested hotfix to the problem described at: [DestructibleComponent does not respect calls to UPrimitiveComponent::SetCollisionEnabled or AActor::SetActorEnableCollision at runtime - World Creation - Epic Developer Community Forums](https://answers.unrealengine.com/questions/354110/destructiblecomponent-does-not-respect-calls-to-up.html)
2. Place an instance of this component in a level, and ensure ‘Can Affect Navigation’ is true
3. Ensure your project has dynamic navmesh rebuilding enabled
4. Do ‘show navigation’ and ensure there is a nav mesh correctly setup
5. Note that the area around the component is marked as not navigable
6. Add some blueprint script that sets the collision for the component/actor to NoCollision
7. Note that the area around the component is still marked as not navigable

Expected result: when collision is disabled, the area should be marked as navigable.

This appears to be due to the following function:

```
bool UPrimitiveComponent::IsNavigationRelevant() const 
{ 
	if (!CanEverAffectNavigation())
	{
		return false;
	}

	if (HasCustomNavigableGeometry() >= EHasCustomNavigableGeometry::EvenIfNotCollidable)
	{
		return true;
	}

	const FCollisionResponseContainer& ResponseToChannels = GetCollisionResponseToChannels();
	return IsCollisionEnabled() &&
		(ResponseToChannels.GetResponse(ECC_Pawn) == ECR_Block || ResponseToChannels.GetResponse(ECC_Vehicle) == ECR_Block);
}

```

In the constructor of DestructibleComponent, hasCustomNavigableGeometry is set:

```
	bHasCustomNavigableGeometry = EHasCustomNavigableGeometry::EvenIfNotCollidable;

```

This means that even if collision is disabled, the mesh will still be considered non-navigable. Is this intended?

I’m hesitant to change this flag as the comment for it is:

```
		// DoCustomNavigableGeometryExport() should be called even if the mesh is non-collidable and wouldn't normally affect the navmesh

```

This doesn’t mention anything about it’s behaviour regarding IsNavigationRelevant.

Thanks,

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [January 7, 2016, 6:00pm UTC](https://forums.unrealengine.com/t/destructible-components-always-effect-nav-mesh-even-when-collision-disabled/343308/2 "2016-01-07T18:00:03Z")

</div>

Hey eyesiah-

Can you explain exactly what code you added/changed? I’m unable to find OnActorEnableCollisionChanged() or SetCollisionEnabled() inside the PrimitiveComponent.cpp file. Please explain exactly how you applied the hotfix you mentioned to help me work through your reproduction steps.

Cheers

---

<div class="post-metadata">

**Author:** ![eyesiah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eyesiah](https://forums.unrealengine.com/u/eyesiah)\
**Post date:** [January 7, 2016, 6:29pm UTC](https://forums.unrealengine.com/t/destructible-components-always-effect-nav-mesh-even-when-collision-disabled/343308/3 "2016-01-07T18:29:47Z")

</div>

Attached is the hotfix for the other issue.

```
[link text][1]

```

And here’s a hotfix I’ve created for this issue

```
bool UDADestructibleComponent::IsNavigationRelevant() const
{
	if (!CanEverAffectNavigation())
	{
		return false;
	}

	const FCollisionResponseContainer& ResponseToChannels = GetCollisionResponseToChannels();
	bool relevant = IsCollisionEnabled() &&
		(ResponseToChannels.GetResponse(ECC_Pawn) == ECR_Block || ResponseToChannels.GetResponse(ECC_Vehicle) == ECR_Block);

	return relevant;
}

ECollisionEnabled::Type UDADestructibleComponent::GetCollisionEnabled() const
{
	if (GetOwner() && !GetOwner()->GetActorEnableCollision())
	{
		return ECollisionEnabled::NoCollision;
	}

	return Super::GetCollisionEnabled();
}

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [January 11, 2016, 8:54pm UTC](https://forums.unrealengine.com/t/destructible-components-always-effect-nav-mesh-even-when-collision-disabled/343308/4 "2016-01-11T20:54:39Z")

</div>

Hey eyesiah-

I’ve added the code you posted to a class however I’m not sure what you mean in the second step by adding “an instance of the component to the level.” Could you also explain how the blueprint mentioned in step 6 is setup? Is the blueprint based on Actor or something else? Are you adding the custom destructible class as a component to this blueprint (if so does that mean that the class is marked as Blueprintable)?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [January 19, 2016, 9:03pm UTC](https://forums.unrealengine.com/t/destructible-components-always-effect-nav-mesh-even-when-collision-disabled/343308/5 "2016-01-19T21:03:48Z")

</div>

Hey eyesiah-

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

---

<div class="post-metadata">

**Author:** ![eyesiah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eyesiah](https://forums.unrealengine.com/u/eyesiah)\
**Post date:** [January 19, 2016, 9:09pm UTC](https://forums.unrealengine.com/t/destructible-components-always-effect-nav-mesh-even-when-collision-disabled/343308/6 "2016-01-19T21:09:32Z")

</div>

Sorry - this slipped my mind. I’ll reply to your question above as soon as I’m able.

---

<div class="post-metadata">

**Author:** ![eyesiah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eyesiah](https://forums.unrealengine.com/u/eyesiah)\
**Post date:** [January 27, 2016, 11:27am UTC](https://forums.unrealengine.com/t/destructible-components-always-effect-nav-mesh-even-when-collision-disabled/343308/7 "2016-01-27T11:27:41Z")

</div>

Hi ,  
Really sorry about the delay here.

By “an instance of the component to the level.”, I mean:

1. Create a blueprint
2. Add a component of the new type to the blueprint
3. Add an actor of that blueprint type to the level

Yes, the component class is marked Blueprintable.

The script mentioned in step 6 is added to the level script. Create a new custom event with a name like “RunTest”, and setup that event to toggle the collision on the actor and/or component. Then play in PIE, and use console command “ce RunTest” to run the script you set up.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [January 27, 2016, 10:06pm UTC](https://forums.unrealengine.com/t/destructible-components-always-effect-nav-mesh-even-when-collision-disabled/343308/8 "2016-01-27T22:06:21Z")

</div>

Hey eyesiah-

I was able to reproduce the navigation issue and have entered a bug report (UE-26121) for investigation.

Cheers
