8#include "CoreMinimal.h"
11#include "PIDDrone.generated.h"
13class USkeletalMeshComponent;
14class UStaticMeshComponent;
35 return mesh->GetComponentTransform();
39 return GetActorTransform();
46 UFUNCTION(BlueprintCallable, Category =
"Drone")
49 DroneParameters.DroneAction = mode;
56 UFUNCTION(BlueprintCallable, Category =
"Drone")
59 return DroneParameters.DroneAction;
62 UFUNCTION(BlueprintCallable, Category =
"Drone")
65 return DroneParameters;
68 UFUNCTION(BlueprintCallable, Category =
"Drone")
72 UE_LOG(LogTemp, Warning, TEXT(
"Parameters Changed!"));
74 SetDroneParameters(newParameters);
79 DroneParameters = InParameters;
82 UFUNCTION(BlueprintCallable, Category =
"Drone")
83 void AddWayPoint(FVector Waypoint)
86 transform.SetLocation(Waypoint);
88 DroneParameters.
Points.Add(transform);
91 UFUNCTION(BlueprintCallable, Category =
"Drone")
94 DroneParameters.Points.Empty();
100 UFUNCTION(BlueprintCallable, Category =
"Drone")
101 void FlySetFlightpath();
103 UFUNCTION(BlueprintCallable, Category = "
Drone")
104 void SetManualControl(
bool value)
106 manualControl = value;
113 void MoveDroneToPosition(
const FTransform
Transform);
120 UFUNCTION(BlueprintCallable, Category =
"Drone")
121 TArray<FTransform> GenerateRoamingPoints(
float radius, int32 roamingPoints);
123 virtual
void SetCurrentTransformToMovedFromGarageTransform()
override
127 MovedFromGarageTransform = mesh->GetComponentTransform();
128 UE_LOG(LogTemp, Warning, TEXT(
"Moved from garage transform %s"), *MovedFromGarageTransform.ToString());
133 MovedFromGarageTransform = GetActorTransform();
134 UE_LOG(LogTemp, Warning, TEXT(
"ACTOR Moved from garage transform WHAT IS THIS: %s"), *MovedFromGarageTransform.ToString());
141 virtual void BeginPlay()
override;
143 virtual void Tick(
float DeltaTime)
override;
145 virtual void EndPlay(
const EEndPlayReason::Type EndPlayReason)
override;
147 void AutoPilot(
float DeltaTime);
149 UFUNCTION(BlueprintCallable)
150 bool IsRoaming()
const
155 UFUNCTION(BlueprintCallable)
156 void SetDesiredLocationMesh(UStaticMeshComponent* meshcomponent)
158 desiredPositionMesh = meshcomponent;
161 UFUNCTION(BlueprintCallable)
162 void AssignRoamingPoints(
const TArray<FTransform> Points);
164 UFUNCTION(BlueprintCallable)
165 void SetDroneRotation(USkeletalMeshComponent* target, FRotator rotator);
167 UFUNCTION(BlueprintCallable)
168 FVector GetCurrentWaypointTarget();
176 UWorld* World =
nullptr;
178 FVector StartingPosition;
180 USkeletalMeshComponent* mesh =
nullptr;
181 UStaticMeshComponent* desiredPositionMesh =
nullptr;
183 bool waypointReached = false;
184 bool manualControl = false;
187 TArray<FVector> WayPoints = {
189 {11779.536955,6566.541435,5000}
192 int32 passedWaypoints = 0;
static EDroneAction GetDroneAction(FString actionstring)
virtual FTransform GetInteractableWorldTransform_Implementation() const override
void SetDroneParameters(const FDroneParameters &InParameters)
FDroneParameters DroneParameters
virtual EVehicleTypes GetVehicleType() const override
TArray< FTransform > Points