Is there a way to disable collision for an object in realtime to affect pathfinding?

Is there a way to disable collision for an object in realtime to affect pathfinding? I want to move a pawn to a target location and pass through some objects if certain ingame conditions are set. On other times the same objects should block the pawn.

If I disable collisions on this objects before play, it works as expected. But if I disable collisions within blueprint, the pathfinding won’t find a valid path and the pawn does nothing.

I’ve made a simple example project with the topdown template.

Trying to force a navmesh rebuild with console command “RebuildNavigation” also didn’t help. Any ideas? Thank you.

I am not sure, but I remember seeing an option like ‘Can Ever Affect Navigation’ inside collision settings. I have not tried altering it during gameplay. Perhaps if you change that during gameplay and rebuild the navmesh, it might work. Its worth a try

I’ve tried altering bCanEverAffectNavigation with a custom blueprint method in c++:

void ACEANGameMode::ToggleCanEverAffectNavigation(AStaticMeshActor *Actor)
{
	Actor->GetStaticMeshComponent()->SetCanEverAffectNavigation(false);
}

So I modified the example project to call this method and force a navmesh rebuild after that. Sadly it had no effect at all.

I wonder if I’m doing something terribly wrong here or if this is just not possible at all…

Have you tried enabling run time navigation rebuild in the nav mesh recast in your level? If you enable that, I think rebuild navigation should do the trick.

Yes, I’ve tried this with no luck … :frowning: