Files
UnrealEngineUWP/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/Physics/PhysicsDataCollection.h
michael balzer a49c74b915 MeshModelingToolset: Move ModelingOperators and ModelingOperatorsEditorOnly modules out of experimental plugin
#jira UETOOL-3823
#rb lonnie.li
#preflight 617b1aea5794a500014f544a

#ROBOMERGE-AUTHOR: michael.balzer
#ROBOMERGE-SOURCE: CL 17972239 in //UE5/Release-5.0/... via CL 17972248
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v885-17909292)
#ROBOMERGE[STARSHIP]: UE5-Main

[CL 17972256 by michael balzer in ue5-release-engine-test branch]
2021-10-28 19:47:45 -04:00

85 lines
2.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "ShapeApproximation/SimpleShapeSet3.h"
#include "Engine/StaticMesh.h"
#include "PhysicsEngine/AggregateGeom.h"
class UActorComponent;
class UBodySetup;
/**
* FPhysicsDataCollection holds onto physics-system data that is needed for various interactive tools and algorithms.
* Currently this is split into two parts, pointers to the owning physics state, and collision geometry data.
*
* The collision geometry data is stored in both the editable GeometryProcessing format and the
* physics-system representations (currently FKAggregateGeom but more are expected).
* This class provides a high-level API for transferring geometry between these two representations.
*/
class MODELINGCOMPONENTS_API FPhysicsDataCollection
{
public:
//
// External State Data
//
/** The Component this physics data came from / is for */
TWeakObjectPtr<const UActorComponent> SourceComponent;
/** The StaticMesh this physics data came from / is for */
TWeakObjectPtr<const UStaticMesh> SourceStaticMesh;
/** The BodySetup in use by the SourceComponent */
TWeakObjectPtr<const UBodySetup> BodySetup;
/** Scaling factor applied to the SourceComponent, which should be transferred to Collision Geometry in some cases */
FVector ExternalScale3D = FVector::OneVector;
//
// Geometry data
//
/**
* Stores representation of Collision geometry
*/
UE::Geometry::FSimpleShapeSet3d Geometry;
/**
* Collision geometry in Physics-system format. Not necessarily in sync with Geometry member.
*/
FKAggregateGeom AggGeom;
/**
* Initialize from the given Component, and optionally initialize internal geometry members
*/
void InitializeFromComponent(const UActorComponent* Component, bool bInitializeAggGeom);
/**
* Initialize from the given StaticMesh, and optionally initialize internal geometry members
*/
void InitializeFromStaticMesh(const UStaticMesh* StaticMesh, bool bInitializeAggGeom);
/**
* Initialize
*/
void InitializeFromExisting(const FPhysicsDataCollection& Other);
/**
* replace our geometry data with that from another FPhysicsDataCollection
*/
void CopyGeometryFromExisting(const FPhysicsDataCollection& Other);
/**
* Empty out our FKAggregateGeom
*/
void ClearAggregate();
/**
* Populate our FKAggregateGeom from our FSimpleShapeSet3d
*/
void CopyGeometryToAggregate();
};