- Robots now generate the spline based on their input type - There is now a curve generated with the spline with speed values for any distance along the spline
97 lines
2.7 KiB
C++
97 lines
2.7 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "RobotSettings.generated.h"
|
|
|
|
|
|
class ALuckyRobotPawnBase;
|
|
class USplineComponent;
|
|
class ULuckyRobotMovementComponent;
|
|
class AMujocoVolumeActor;
|
|
|
|
UENUM(BlueprintType)
|
|
enum class ERobotInputType : uint8
|
|
{
|
|
None UMETA(DisplayName = "None"),
|
|
Move UMETA(DisplayName = "Move"),
|
|
Turn UMETA(DisplayName = "Turn"),
|
|
Pathfinding UMETA(DisplayName = "Pathfinding")
|
|
};
|
|
|
|
UENUM(BlueprintType)
|
|
enum class ERobotInputHandlingMethod : uint8
|
|
{
|
|
None UMETA(DisplayName = "None"),
|
|
SingleInput UMETA(DisplayName = "SingleInput"),
|
|
CombinedInput UMETA(DisplayName = "CombinedInput")
|
|
};
|
|
|
|
USTRUCT(BlueprintType)
|
|
struct FRobotSettings
|
|
{
|
|
GENERATED_USTRUCT_BODY()
|
|
|
|
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Robot Settings")
|
|
float SpeedLimit = 15.f;
|
|
|
|
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Robot Settings")
|
|
TSubclassOf<AMujocoVolumeActor> MujocoSettings;
|
|
|
|
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Robot Settings")
|
|
TSubclassOf<ULuckyRobotMovementComponent> MovementComponentClass;
|
|
|
|
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Robot Settings")
|
|
ERobotInputHandlingMethod InputHandlingMethod = ERobotInputHandlingMethod::CombinedInput;
|
|
};
|
|
|
|
USTRUCT(BlueprintType)
|
|
struct FRobotNavPoint
|
|
{
|
|
GENERATED_USTRUCT_BODY()
|
|
|
|
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Robot Nav Point")
|
|
FVector Location = FVector::ZeroVector;
|
|
|
|
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Robot Nav Point")
|
|
bool bDestination = false;
|
|
};
|
|
|
|
USTRUCT(BlueprintType)
|
|
struct FRobotNavPath
|
|
{
|
|
GENERATED_USTRUCT_BODY()
|
|
|
|
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Robot Nav Path")
|
|
TArray<FRobotNavPoint> NavPoints;
|
|
};
|
|
|
|
USTRUCT(BlueprintType)
|
|
struct FRobotSplinePath
|
|
{
|
|
GENERATED_USTRUCT_BODY()
|
|
|
|
UPROPERTY(BlueprintReadOnly, Category = "Robot Spline Path")
|
|
TWeakObjectPtr<ALuckyRobotPawnBase> Robot;
|
|
|
|
UPROPERTY(BlueprintReadOnly, Category = "Robot Spline Path")
|
|
FRobotNavPath NavPath = FRobotNavPath();
|
|
|
|
UPROPERTY(BlueprintReadOnly, Category = "Robot Spline Path")
|
|
TWeakObjectPtr<USplineComponent> SplinePath;
|
|
|
|
UPROPERTY(BlueprintReadOnly, Category = "Robot Spline Path")
|
|
FRuntimeFloatCurve SplinePathSpeedModifier = FRuntimeFloatCurve();
|
|
|
|
ALuckyRobotPawnBase* GetRobot() const { return Robot.Get(); }
|
|
void GenerateSplinePath(ALuckyRobotPawnBase* InRobot, const FRobotNavPath& InNavPath);
|
|
void RegenerateSplinePathValues();
|
|
USplineComponent* GetSplinePath() const { return SplinePath.Get(); }
|
|
|
|
FRobotSplinePath() {}
|
|
FRobotSplinePath(ALuckyRobotPawnBase* InRobot, const FRobotNavPath& InNavPath)
|
|
{
|
|
GenerateSplinePath(InRobot, InNavPath);
|
|
}
|
|
}; |