Nailed it on the first try!
Using Unreal E4 V. 4.21
Header Files;
#include "Grabber.h"
#include "GameFramework/Actor.h"
#include "Runtime/Core/Public/Math/Vector.h"
#include "Runtime/Core/Public/Math/Rotator.h"
#include "GameFramework/Controller.h"
#include "GameFramework/PlayerController.h"
#include "Engine/World.h"
#include "Runtime/Engine/Public/DrawDebugHelpers.h"
#include "Runtime/Engine/Public/CollisionQueryParams.h"
#include "Runtime/Engine/Classes/Engine/EngineTypes.h"
#include "Runtime/Engine/Classes/PhysicsEngine/PhysicsHandleComponent.h"
#include "Runtime/Engine/Classes/Components/InputComponent.h"
Header File’s Header Files lol;
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Runtime/Engine/Classes/PhysicsEngine/PhysicsHandleComponent.h"
#include "Runtime/Engine/Classes/Components/InputComponent.h"
#include "Grabber.generated.h"
InputComp = GetOwner()->FindComponentByClass<UInputComponent>();
if (InputComp)
{
//makes sure actor has input component attached. helps prevent potential UNREAL crashing
UE_LOG(LogTemp, Warning, TEXT("Object ''%s'' Input Component found."), *GetOwner()->GetName());
InputComp->BindAction("PlayerGrab", IE_Pressed, this, &UGrabber::PlayerGrab);
InputComp->BindAction("PlayerGrab", IE_Released, this, &UGrabber::PlayerRelease);
}
else
{
UE_LOG(LogTemp, Error, TEXT("Object ''%s'' does not have an Input Component."), *GetOwner()->GetName());
}
}
void UGrabber::PlayerGrab()
{
UE_LOG(LogTemp, Warning, TEXT("Grab Pressed"));
}
void UGrabber::PlayerRelease()
{
UE_LOG(LogTemp, Warning, TEXT("Grab Released"));
}