mosssi
(mosssi)
1
Hi there,
I want to create a CustomTraceFunction and use it inside my actor multiple times so I implemented this:
header:
UFUNCTION()
bool CustomSingleLineTrace(const FVector& Start, const FVector& End, const FCollisionQueryParams& Params);
cpp:
bool AMyActor::CustomSingleLineTrace(const FVector& Start, const FVector& End, const FCollisionQueryParams& Params)
{
UE_LOG(LogTemp, Warning, TEXT("Custom Trace"));
return true;
}
and included “CollisionQueryParams.h” in cpp and header.
But my code has a error in compile like this:
Error Unrecognized type ‘FCollisionQueryParams’ - type must be a UCLASS, USTRUCT or UENUM
Can you tell me what is my problem here?
Thank you
I’m at the same place you are. I got some code in but, i get a false that it did not hit anything and i think it is the way i set up the params.
What i did was in my .h file i defined the struct to be used.
struct FCollisionQueryParams DropParams;
Then i added these before i used it in cpp file.
DropParams.TraceTag = "Drop";
DropParams.bReturnFaceIndex = true;
Then i used it like so
bool bFindIt = GetMesh()->LineTraceComponent(OutHit, SpawnLocation, EndLocation, DropParams);
All i am after is to drop the model i spawned to the model below it, so it will set on it.
Anyone who has done this, can we or I get your help?
Think i have this solved, i was using a skeletal mesh and now changed it to static mesh. Find out after compile finishes and i test it.
You cannot declare FCollisionQueryParams with UFUNCTION as a parameter, nor UPROPERTY as an class member. Just removed macro and that did the trick.