Advertisement
Guest User

ItemGrabber.h

a guest
Jun 3rd, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.29 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include "CoreMinimal.h"
  4. #include "Components/ActorComponent.h"
  5. #include "PhysicsEngine/PhysicsHandleComponent.h"
  6.  
  7. #include "ItemGrabber.generated.h"
  8.  
  9.  
  10. // -----------------------------------------------------------------------
  11. /// The location/position and rotation of the player view.
  12. struct FPlayerView
  13. {
  14.     FVector Location;
  15.     FRotator Rotation;
  16. };
  17.  
  18.  
  19. // -----------------------------------------------------------------------
  20. UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
  21. class ESCAPE_API UItemGrabber : public UActorComponent
  22. {
  23.     GENERATED_BODY()
  24.  
  25. public:
  26.     // Sets default values for this component's properties
  27.     UItemGrabber();
  28.  
  29. protected:
  30.     // Called when the game starts
  31.     virtual void BeginPlay() override;
  32.  
  33. public:
  34.     // Called every frame
  35.     virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
  36.  
  37. private:
  38.     // Variables.
  39.     UPROPERTY(EditAnywhere)
  40.     APlayerController* Player;
  41.     FPlayerView PlayerView;
  42.     FHitResult GrabbableHit;
  43.     AActor GrabbableActor;
  44.     FVector LineTraceEnd;
  45.     float Reach = 1000;
  46.     UPhysicsHandleComponent* PhysicsHandle = nullptr;
  47.     // Functions.
  48.     void GetGrabbableObject();
  49.  
  50.     // Debug helper functions.
  51.     void DebugLineStuff();
  52.     void NotifyLoading();
  53.  
  54. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement