I didn’t set up the collision query params as a variable like Ben did in line 57. I only put ECC_PhysicsBody as a parameter for the LineTraceSingleByObjectType function like this:
FHitResult HitObject;
bool bHitSomething = GetWorld()->LineTraceSingleByObjectType(
OUT HitObject,
PlayerPosition,
TraceLineEnd,
ECC_PhysicsBody
);
if (bHitSomething)
{
UE_LOG(LogTemp, Warning, TEXT("%s"), *HitObject.GetActor()->GetName());
}
Obviously, i didn’t use FCollisionQueryParams(ECollisionChannel::ECC_PhysicsBody)
like he did, but still everything worked fine. I’m using UE4 v4.21. Does anyone know why it worked like this?