I’ve been messing around with Sweep functions today, mainly trying to make SweepTest to work but for some reason it was not. After a while (and many tests), I simply tried using SweepSingle instead, which worked instantly…
In the code below, you can see that both call are the same, with the only exception being that SweepSingle takes a FHitResult param… Is there something I’m missing here about sweep in general or what?
I don’t care what the sweep hits (the reason why I wanted to use SweepTest in the first place) but I’m “forced” using the SweepSingle version of the call, what is the reason?
Thanks in advance!
UWorld* world = UJotunnMain::Instance->GetWorld();
FVector camPos = UJotunnMain::Instance->GetCamera()->GetCameraPosition();
FCollisionQueryParams collisionQueryParam(TEXT("SphereCam"), false);
FHitResult resultCol;
if (world->SweepSingle(resultCol, camPos, camPos + FVector(0,0,100), FQuat::Identity, FCollisionShape::MakeSphere(mEnvCollisionRadius), collisionQueryParam, FCollisionObjectQueryParams(ECC_WorldStatic)))
{
//It enters here correctly when hitting an actor flagged WorldStatic
}
else
{
//It enters here correctly when NOT hitting an actor flagged WorldStatic
}
if(world->SweepTest(camPos, camPos + FVector(0, 0, 100), FQuat::Identity, FCollisionShape::MakeSphere(mEnvCollisionRadius), collisionQueryParam, FCollisionObjectQueryParams(ECC_WorldStatic)))
{
//It nevers enter here
}
else
{
//Its always here...
}