Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beatthat/22d259d1980ca8e746650adb745f9c39 to your computer and use it in GitHub Desktop.
Save beatthat/22d259d1980ca8e746650adb745f9c39 to your computer and use it in GitHub Desktop.
// Copyright Larry Kirschner
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "PhysicsEngine/PhysicsHandleComponent.h"
#include "Components/InputComponent.h"
#include "Grabber.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDINGESCAPE_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:
UPROPERTY(EditAnywhere)
float Reach = 300.f;
UPhysicsHandleComponent* PhysicsHandle = nullptr;
UInputComponent* InputComponent = nullptr;
template <typename T>
FORCEINLINE void FindAndAssign<T>(AActor* Owner, T*& AssignToProperty)
{
// T* Comp = Owner->FindComponentByClass<T>();
//
// if(Comp) {
// UE_LOG(LogTemp, Warning, TEXT("OK found required component"));
// AssignToProperty = Comp;
// return;
// }
// else {
// UE_LOG(LogTemp, Error, TEXT("Missing required component"));
// }
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment