8#include "CoreMinimal.h"
12#include "Components/SkeletalMeshComponent.h"
13#include "Components/StaticMeshComponent.h"
15#include "PIDDrone.generated.h"
36 return mesh->GetComponentTransform();
40 return GetActorTransform();
47 UFUNCTION(BlueprintCallable, Category =
"Drone")
50 DroneParameters.DroneAction = mode;
57 UFUNCTION(BlueprintCallable, Category =
"Drone")
60 return DroneParameters.DroneAction;
63 UFUNCTION(BlueprintCallable, Category =
"Drone")
66 return DroneParameters;
69 UFUNCTION(BlueprintCallable, Category =
"Drone")
73 UE_LOG(LogTemp, Warning, TEXT(
"Parameters Changed!"));
75 SetDroneParameters(newParameters);
80 DroneParameters = InParameters;
83 UFUNCTION(BlueprintCallable, Category =
"Drone")
84 void AddWayPoint(FVector Waypoint)
87 transform.SetLocation(Waypoint);
89 DroneParameters.
Points.Add(transform);
92 UFUNCTION(BlueprintCallable, Category =
"Drone")
95 DroneParameters.Points.Empty();
101 UFUNCTION(BlueprintCallable, Category =
"Drone")
102 void FlySetFlightpath();
104 UFUNCTION(BlueprintCallable, Category = "Drone")
105 void SetManualControl(
bool value)
107 manualControl = value;
114 void MoveDroneToPosition(
const FTransform Transform);
121 UFUNCTION(BlueprintCallable, Category =
"Drone")
122 TArray<FTransform> GenerateRoamingPoints(
float radius, int32 roamingPoints);
124 virtual
void SetCurrentTransformToMovedFromGarageTransform()
override
128 MovedFromGarageTransform = mesh->GetComponentTransform();
129 UE_LOG(LogTemp, Warning, TEXT(
"Moved from garage transform %s"), *MovedFromGarageTransform.ToString());
134 MovedFromGarageTransform = GetActorTransform();
135 UE_LOG(LogTemp, Warning, TEXT(
"ACTOR Moved from garage transform WHAT IS THIS: %s"), *MovedFromGarageTransform.ToString());
142 ShowForwardArrow = Show;
145 UFUNCTION(BlueprintCallable, Category =
"Drone")
146 bool GetShowForwardArrow()
const
148 return ShowForwardArrow;
153 virtual void BeginPlay()
override;
155 virtual void Tick(
float DeltaTime)
override;
157 virtual void EndPlay(
const EEndPlayReason::Type EndPlayReason)
override;
159 void AutoPilot(
float DeltaTime);
161 UFUNCTION(BlueprintCallable)
162 bool IsRoaming()
const
167 UFUNCTION(BlueprintCallable)
168 void SetDesiredLocationMesh(UStaticMeshComponent* meshcomponent)
170 desiredPositionMesh = meshcomponent;
173 UFUNCTION(BlueprintCallable)
174 void AssignRoamingPoints(
const TArray<FTransform> Points);
176 UFUNCTION(BlueprintCallable)
177 void SetDroneRotation(USkeletalMeshComponent* target, FRotator rotator);
179 UFUNCTION(BlueprintCallable)
180 FVector GetCurrentWaypointTarget();
188 UWorld* World =
nullptr;
190 FVector StartingPosition;
192 USkeletalMeshComponent* mesh =
nullptr;
193 UStaticMeshComponent* desiredPositionMesh =
nullptr;
195 bool waypointReached = false;
196 bool manualControl = false;
199 TArray<FVector> WayPoints = {
201 {11779.536955,6566.541435,5000}
204 int32 passedWaypoints = 0;
206 bool ShowForwardArrow =
false;
static EDroneAction GetDroneAction(FString actionstring)
virtual FTransform GetInteractableWorldTransform_Implementation() const override
void SetDroneParameters(const FDroneParameters &InParameters)
FDroneParameters DroneParameters
virtual EVehicleTypes GetVehicleType() const override
void SetShowForwardArrow(bool Show)
TArray< FTransform > Points