Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "CoreMinimal.h"
- #include "Components/ActorComponent.h"
- #include "PhysicsEngine/PhysicsHandleComponent.h"
- #include "ItemGrabber.generated.h"
- // -----------------------------------------------------------------------
- /// The location/position and rotation of the player view.
- struct FPlayerView
- {
- FVector Location;
- FRotator Rotation;
- };
- // -----------------------------------------------------------------------
- UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
- class ESCAPE_API UItemGrabber : public UActorComponent
- {
- GENERATED_BODY()
- public:
- // Sets default values for this component's properties
- UItemGrabber();
- 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:
- // Variables.
- UPROPERTY(EditAnywhere)
- APlayerController* Player;
- FPlayerView PlayerView;
- FHitResult GrabbableHit;
- AActor GrabbableActor;
- FVector LineTraceEnd;
- float Reach = 1000;
- UPhysicsHandleComponent* PhysicsHandle = nullptr;
- // Functions.
- void GetGrabbableObject();
- // Debug helper functions.
- void DebugLineStuff();
- void NotifyLoading();
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement