Please Help me for This Error

no error but in complie. Unreal have error :show in photo.
i can’t .I use Visual studio and UE is UE 4.26.2
cpp file
// Copyright GameDev_W8at 2021.

#include “DrawDebugHelpers.h”
#include “Engine/World.h”
#include “GameFramework/PlayerController.h”
#include “Grabber.h”

#define OUT

// Sets default values for this component’s properties
UGrabber::UGrabber()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don’t need them.
PrimaryComponentTick.bCanEverTick = true;

// ...

}

// Called when the game starts
void UGrabber::BeginPlay()
{
Super::BeginPlay();

PhysicsHandle = GetOwner()->FindComponentByClass<UPhysicsHandleComponent>();

if (PhysicsHandle)
{
	// Physics is Found.
}
else
{
	UE_LOG(LogTemp, Error, TEXT("No Physics Handle Componet found on %S!"),GetOwner()->GetName());
}

}

// Called every frame
void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

FVector PlayerViewPointLocation;
FRotator PlayerViewPointRotation;

GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
	OUT PlayerViewPointLocation,
	OUT PlayerViewPointRotation
);

/*UE_LOG(LogTemp, Warning, TEXT("Location :%s, Rotation :%s"),
	*PlayerViewPointLocation.ToString(),
	*PlayerViewPointRotation.ToString()
);*/

FVector LineTraceEnd = PlayerViewPointLocation + PlayerViewPointRotation.Vector() * Reach;

DrawDebugLine(
	GetWorld(),
	PlayerViewPointLocation,
	LineTraceEnd,
	FColor(0,255,0),
	false,
	0.f,
	0,
	5.f
);

FHitResult Hit;
// Ray-cast out to a certain distance (Reach)
FCollisionQueryParams TraceParams(FName(TEXT("")), false, GetOwner());

GetWorld()->LineTraceSingleByObjectType(
	OUT Hit,
	PlayerViewPointLocation,
	LineTraceEnd,
	FCollisionObjectQueryParams(ECollisionChannel::ECC_PhysicsBody),
	TraceParams
);

// See what it hits
AActor* ActorHit = Hit.GetActor();

if (ActorHit)
{
	UE_LOG(LogTemp, Warning, TEXT("Line trace has hit: %s"), *(ActorHit->GetName()))
}

}

Header file

// Copyright GameDev_W8at 2021.

#pragma once

#include “CoreMinimal.h”
#include “Components/ActorComponent.h”
#include “PhysicsEngine/PhysicsHandleComponent.h”
#include “Grabber.generated.h”

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDING_ESCAPE_API UGrabber : public UActorComponent
{
GENERATED_BODY()

public:
// Sets default values for this component’s properties
UGrabber();

protected:
// Called when the game starts
virtual void BeginPlay() override;

public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

private:
float Reach = 100.f;

UPhysicsHandleComponent* PhysicsHandle = nullptr;

};

But Using FindComponetByClass() assignment to commented.That has no complie error.

Solved … hee hee sry…
UE_LOG(LogTemp, Error, TEXT(“No Physics Handle Componet found on %S!”),*GetOwner()->GetName());
Misssing * .
Sry heee … and How to delete for this post so that is still.
Thanks .

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

Privacy & Terms