Destructible Components always effect nav mesh even when collision disabled

  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
  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,

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

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();
}

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)?

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.

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

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.

Hey eyesiah-

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

Cheers