Exception on first invocation of SweepMultiByProfile

GlassBeaver
Fri, 02 Feb 2018 06:35:03 +0000
AI

I’m using SweepMultiByProfile in a UBTService and I always get an exception the very first time it is executed when playing the game. I use similar sweeps in other classes without an issue.

void UAI_PickupScanner::TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
{
	UBlackboardComponent* blackBoardComp = OwnerComp.GetBlackboardComponent();
	TArray<FHitResult> hits;
	APawn* pawn = OwnerComp.GetAIOwner()->GetPawn();
	FVector actorLocation = pawn->GetActorLocation();

	GetWorld()->SweepMultiByProfile(hits, actorLocation, actorLocation, FQuat::Identity, FName("OverlapAllDynamic"), FCollisionShape::MakeSphere(SearchRadius));

  ........

SearchRadius is normally set to 4000.0f

This causes the game to hang for about 4 seconds, with StackWalkAndDump taking 3.5 seconds on average. It only happens the first time the TickNode and the sweep are called, and subsequently the game runs without an issue.

Here is the relevant part of the exception:

LogStats: FPlatformStackWalk::StackWalkAndDump - 3.634 s
LogOutputDevice: Error: === Handled ensure: ===
LogOutputDevice: Error: Ensure condition failed: OutResult.ImpactNormal.IsNormalized() [File:D:\Build++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\Engine\Private\Collision\CollisionConversions.cpp] [Line: 992]
LogOutputDevice: Error: Stack:
LogOutputDevice: Error: [Callstack] 0x00000000E2902786 UE4Editor-Core.dll!FWindowsPlatformStackWalk::StackWalkAndDump() [d:\build++ue4+release-4.18+compile\sync\engine\source\runtime\core\private\windows\windowsplatformstackwalk.cpp:200]
LogOutputDevice: Error: [Callstack] 0x00000000E26A123A UE4Editor-Core.dll!FDebug::EnsureFailed() [d:\build++ue4+release-4.18+compile\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:298]
LogOutputDevice: Error: [Callstack] 0x00000000E26BB906 UE4Editor-Core.dll!FDebug::OptionallyLogFormattedEnsureMessageReturningFalse() [d:\build++ue4+release-4.18+compile\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:425]
LogOutputDevice: Error: [Callstack] 0x00000000D62883E5 UE4Editor-Engine.dll!ConvertOverlappedShapeToImpactHit() [d:\build++ue4+release-4.18+compile\sync\engine\source\runtime\engine\private\collision\collisionconversions.cpp:992]
LogOutputDevice: Error: [Callstack] 0x00000000D6288951 UE4Editor-Engine.dll!ConvertQueryImpactHit() [d:\build++ue4+release-4.18+compile\sync\engine\source\runtime\engine\private\collision\collisionconversions.cpp:437]
LogOutputDevice: Error: [Callstack] 0x00000000D627AD18 UE4Editor-Engine.dll!AddSweepResults() [d:\build++ue4+release-4.18+compile\sync\engine\source\runtime\engine\private\collision\collisionconversions.cpp:595]
LogOutputDevice: Error: [Callstack] 0x00000000D62974CC UE4Editor-Engine.dll!GeomSweepMulti_PhysX() [d:\build++ue4+release-4.18+compile\sync\engine\source\runtime\engine\private\collision\physxcollision.cpp:1201]
LogOutputDevice: Error: [Callstack] 0x00000000D6296B5D UE4Editor-Engine.dll!GeomSweepMulti() [d:\build++ue4+release-4.18+compile\sync\engine\source\runtime\engine\private\collision\physxcollision.cpp:1254]
LogOutputDevice: Error: [Callstack] 0x00000000D62BD8AE UE4Editor-Engine.dll!UWorld::SweepMultiByChannel() [d:\build++ue4+release-4.18+compile\sync\engine\source\runtime\engine\private\collision\worldcollision.cpp:147]
LogOutputDevice: Error: [Callstack] 0x00000000D62BDBE3 UE4Editor-Engine.dll!UWorld::SweepMultiByProfile() [d:\build++ue4+release-4.18+compile\sync\engine\source\runtime\engine\private\collision\worldcollision.cpp:356]
LogOutputDevice: Error: [Callstack] 0x00000000CA01F42B UE4Editor-Horu-9517.dll!UAI_BodypartScanner::TickNode() [c:\work\horu\horu\source\horu\private\ai\ai_pickupscanner.cpp:18]
LogOutputDevice: Error: [Callstack] 0x00000000DE3263BA UE4Editor-AIModule.dll!UBTAuxiliaryNode::WrappedTickNode() [d:\build++ue4+release-4.18+compile\sync\engine\source\runtime\aimodule\private\behaviortree\btauxiliarynode.cpp:66]

8 posts - 1 participant