Hey guys,
Just trying to do a simple line trace here with a debug line, but it won’t build saying that DrawDebugLine() Identifier Not Found. What gives?
void ALifeCharacter::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
FVector CamLoc;
FRotator CamRot;
Controller->GetPlayerViewPoint(CamLoc, CamRot); // Get the camera position and rotation
const FVector StartTrace = CamLoc; // trace start is the camera location
const FVector Direction = CamRot.Vector();
const FVector EndTrace = StartTrace + Direction * 200;
// Perform trace to retrieve hit info
FCollisionQueryParams TraceParams(FName(TEXT("WeaponTrace")), true, this);
TraceParams.bTraceAsyncScene = true;
TraceParams.bReturnPhysicalMaterial = true;
FHitResult Hit(ForceInit);
if (GetWorld()->LineTraceSingle(Hit, StartTrace, EndTrace, ECC_WorldStatic, TraceParams))
{
AInventory* NewItem = Cast<AInventory>(Hit.GetActor()); // typecast to the item class to the hit actor
if (bDrawDebugViewTrace)
{
DrawDebugLine(
GetWorld(),
StartTrace,
EndTrace,
FColor(255, 0, 0),
false,
3,
0,
1
);
}
if (NewItem) // if we hit an item with the trace
{
this->PickUpItem(NewItem); // pick it up
}
}
}
Any help is appreciated. Thanks!