FCollisionQueryParams is undefined

Please help
FCollisionQueryParams is undefined and i do not know how to fix it
word is not lighting up blue whenever i type it in
hopefully someone answers

FCollisionQueryParams TraceParameters(FName(TEXT("")), false, GetOwner());

	// ray-cast out to reach distance
FHitResult Hit;
GetWorld()->LineTraceSingleByObjectType(
	OUT Hit,
	PlayerViewPointLocation,
	LineTraceEnd,
	FCollisionQueryParams(ECollisionChannel::ECC_PhysicsBody),
	TraceParameters
);

Maybe you need to include the header file?

#include "Public/CollisionQueryParams.h"

I know this is a few months old now, but I didn’t see that it was solved. FCollisionQueryParams needs to be FCollisionObjectQueryParams. Maybe that is your error?

I just spent about 30 minutes troubleshooting this issue, and got it working. This is how I was able to dismiss the errors and get it working in UE 4.17.2.

Here are all the #includes required so far:

#include “Engine/World.h”
#include “Engine/EngineTypes.h”
#include “DrawDebugHelpers.h”
#include “CollisionQueryParams.h”

FCollisionQueryParams TraceParameters(FName(TEXT("")), false, GetOwner());
GetWorld()->LineTraceSingleByObjectType(
OUT Hit,
PlayerViewPointLocation,
LineTraceEnd,
FCollisionObjectQueryParams(ECollisionChannel::ECC_PhysicsBody),
TraceParameters
);

With the newer versions of Unreal, you have to include what you use. So if you find something is not working while Ben is typing it out, then do a quick Google search to fine the header file(s) required.

1 Like

Privacy & Terms