LineTraceSingleByObjectType function has changed

The specification of the LineTraceSingleByObjectType function has changed
And nothing is said in the corresponding lesson - 121 of section 3.
The Hit argument is no longer a “FHitResult”, it is a TArray
It should be changed.
I am with version 4.25.4 (updated yesterday (23/Oct/2020) with 3 Gb more) from 4.25.3.
The given solution evidently does not compile.

I have to create another solution

	// LineTraceMultiByObjectType Parameters
    TArray<FHitResult> OutHit;
	FCollisionObjectQueryParams CollisionObjectQuery(ECollisionChannel::ECC_PhysicsBody);		// Collision Channel we are using
	FCollisionQueryParams TraceParams(
		FName(TEXT("")),		// now in blank
		false,					// bool bImTraceComplex 
		// GetWorld()->GetFirstPlayerController()->GetPawn()	// const AActor InIgnoreActor;	// Actor to ignore, ourseleves
		// If you remember is the Owner of the Grabber Component
		GetOwner()
	);

	bool Res = GetWorld()->LineTraceMultiByObjectType(
		OUT OutHit,
		IN PlayerViewPointLocation,	// Start
		IN LineTraceEnd,
		IN CollisionObjectQuery,
		IN TraceParams
	);

	// Log out the Actor hit
	// See what it hits
	if (Res)
	{
		UE_LOG(LogTemp, Warning, TEXT("Hit with [%s]   Location: [%s]"),
			*OutHit[0].GetActor()->GetName(),
			*OutHit[0].ImpactPoint.ToString(),
			*OutHit[0].ImpactNormal.ToString()
		);
	}

I hope you will change it

:wink:

Looks like you’re using LineTraceMultiByObjectType instead of LineTraceSingleByObjectType. As far as I can see the Single function hasn’t changed and still takes an FHitResult reference as a parameter.

1 Like

Great, I’ve been wrong again.
Many thanks.
Obviously this is resolved.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms