You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #rb none #ROBOMERGE-OWNER: ryan.durand #ROBOMERGE-AUTHOR: ryan.durand #ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900 #ROBOMERGE-BOT: (v613-10869866) [CL 10870549 by ryan durand in Main branch]
123 lines
3.4 KiB
C++
123 lines
3.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
#include "UObject/Object.h"
|
|
#include "Misc/Guid.h"
|
|
#include "Templates/SubclassOf.h"
|
|
#include "Serialization/BulkData.h"
|
|
#include "AI/Navigation/NavigationTypes.h"
|
|
#include "AI/Navigation/NavCollisionBase.h"
|
|
#include "NavCollision.generated.h"
|
|
|
|
class FPrimitiveDrawInterface;
|
|
struct FCompositeNavModifier;
|
|
struct FNavigableGeometryExport;
|
|
|
|
USTRUCT()
|
|
struct FNavCollisionCylinder
|
|
{
|
|
GENERATED_USTRUCT_BODY()
|
|
|
|
UPROPERTY(EditAnywhere, Category=Cylinder)
|
|
FVector Offset;
|
|
|
|
UPROPERTY(EditAnywhere, Category=Cylinder)
|
|
float Radius;
|
|
|
|
UPROPERTY(EditAnywhere, Category=Cylinder)
|
|
float Height;
|
|
};
|
|
|
|
USTRUCT()
|
|
struct FNavCollisionBox
|
|
{
|
|
GENERATED_USTRUCT_BODY()
|
|
|
|
UPROPERTY(EditAnywhere, Category=Box)
|
|
FVector Offset;
|
|
|
|
UPROPERTY(EditAnywhere, Category=Box)
|
|
FVector Extent;
|
|
};
|
|
|
|
UCLASS(config=Engine)
|
|
class NAVIGATIONSYSTEM_API UNavCollision : public UNavCollisionBase
|
|
{
|
|
GENERATED_UCLASS_BODY()
|
|
|
|
TNavStatArray<int32> ConvexShapeIndices;
|
|
|
|
/** list of nav collision cylinders */
|
|
UPROPERTY(EditAnywhere, Category=Navigation)
|
|
TArray<FNavCollisionCylinder> CylinderCollision;
|
|
|
|
/** list of nav collision boxes */
|
|
UPROPERTY(EditAnywhere, Category=Navigation)
|
|
TArray<FNavCollisionBox> BoxCollision;
|
|
|
|
/** navigation area type (empty = default obstacle) */
|
|
UPROPERTY(EditAnywhere, Category=Navigation)
|
|
TSubclassOf<class UNavArea> AreaClass;
|
|
|
|
/** If set, convex collisions will be exported offline for faster runtime navmesh building (increases memory usage) */
|
|
UPROPERTY(EditAnywhere, Category=Navigation, config)
|
|
uint32 bGatherConvexGeometry : 1;
|
|
|
|
UPROPERTY(EditAnywhere, Category=Navigation, config)
|
|
uint32 bCreateOnClient : 1;
|
|
|
|
/** if set, convex geometry will be rebuild instead of using cooked data */
|
|
uint32 bForceGeometryRebuild : 1;
|
|
|
|
/** Guid of associated BodySetup */
|
|
FGuid BodySetupGuid;
|
|
|
|
/** Cooked data for each format */
|
|
FFormatContainer CookedFormatData;
|
|
|
|
//~ Begin UObject Interface.
|
|
virtual void PostInitProperties() override;
|
|
virtual void Serialize(FArchive& Ar) override;
|
|
virtual void PostLoad() override;
|
|
virtual void GetResourceSizeEx(FResourceSizeEx& CumulativeResourceSize) override;
|
|
virtual bool NeedsLoadForTargetPlatform(const class ITargetPlatform* TargetPlatform) const override;
|
|
virtual bool NeedsLoadForClient() const override { return bCreateOnClient; }
|
|
//~ End UObject Interface.
|
|
|
|
FGuid GetGuid() const;
|
|
|
|
/** Tries to read data from DDC, and if that fails gathers navigation
|
|
* collision data, stores it and uploads to DDC */
|
|
virtual void Setup(class UBodySetup* BodySetup) override;
|
|
|
|
/** copy user settings from other nav collision data */
|
|
void CopyUserSettings(const UNavCollision& OtherData);
|
|
|
|
/** show cylinder and box collisions */
|
|
virtual void DrawSimpleGeom(FPrimitiveDrawInterface* PDI, const FTransform& Transform, const FColor Color) override;
|
|
|
|
/** Get data for dynamic obstacle */
|
|
virtual void GetNavigationModifier(FCompositeNavModifier& Modifier, const FTransform& LocalToWorld) override;
|
|
|
|
/** Export collision data */
|
|
virtual bool ExportGeometry(const FTransform& LocalToWorld, FNavigableGeometryExport& GeoExport) const override;
|
|
|
|
/** Read collisions data */
|
|
void GatherCollision();
|
|
|
|
#if WITH_EDITOR
|
|
virtual void InvalidateCollision() override;
|
|
#endif // WITH_EDITOR
|
|
|
|
protected:
|
|
void ClearCollision();
|
|
|
|
#if WITH_EDITOR
|
|
void InvalidatePhysicsData();
|
|
#endif // WITH_EDITOR
|
|
FByteBulkData* GetCookedData(FName Format);
|
|
};
|