void AMyCharacter::DisplayRaycast()
{
FHitResult* Hitresult = new FHitResult();
FVector StartTrace = FirstPersonCameraComponent->GetComponentLocation();
FVector ForwardVector = FirstPersonCameraComponent->GetForwardVector();
FVector EndTrace = ((ForwardVector * 3319.f) + StartTrace);
FCollisionQueryParams* TraceParams = new FCollisionQueryParams();
if (GetWorld()->LineTraceSingleByChannel(*Hitresult, StartTrace, EndTrace,
ECC_Visibility, *TraceParams))
{
DrawDebugLine(GetWorld(), StartTrace, EndTrace, FColor(255, 0, 0), true);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("You hit: %s"),
*Hitresult->Actor->GetName()));
}
};
Keep getting error that FirstPersonCameraComponent is unidentified, I’ve tried everything that I know and can’t get it right. Any help would be greatly appreciated. Thank you in advance.