Navigation
API > API/Runtime > API/Runtime/GeometryFramework
UDynamicMeshComponent is a mesh component similar to UProceduralMeshComponent, except it bases the renderable geometry off an internal UDynamicMesh instance (which encapsulates a FDynamicMesh3).
There is extensive support for partial updates to render buffers, customizing colors, internally decomposing the mesh into separate chunks for more efficient render updates, and support for attaching a 'Postprocessor' to generate a render mesh on-the-fly See comment sections below for details.
| Name | UDynamicMeshComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/GeometryFramework/Public/Components/DynamicMeshComponent.h |
| Include Path | #include "Components/DynamicMeshComponent.h" |
Syntax
UCLASS (HideCategories=(LOD), Meta=(BlueprintSpawnableComponent), ClassGroup=Rendering, MinimalAPI)
class UDynamicMeshComponent :
public UBaseDynamicMeshComponent ,
public IInterface_CollisionDataProvider
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → USceneComponent → UPrimitiveComponent → UMeshComponent → UBaseDynamicMeshComponent → UDynamicMeshComponent
Implements Interfaces
- IAsyncPhysicsStateProcessor
- IInterface_AssetUserData
- IInterface_AsyncCompilation
- INavRelevantInterface
- IPhysicsComponent
- IMeshCommandChangeTarget
- IMeshReplacementCommandChangeTarget
- IMeshVertexCommandChangeTarget
- IToolFrameworkComponent
- IInterface_CollisionDataProvider
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UDynamicMeshComponent
(
const FObjectInitializer& ObjectInitializer |
Components/DynamicMeshComponent.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FComponentChildrenChangedDelegate | TMulticastDelegate_TwoParams< void, USceneComponent *, bool > | Support for Component attachment change notifications via delegates. | Components/DynamicMeshComponent.h |
| FMeshRegionModified | TMulticastDelegate_ThreeParams< void, UDynamicMeshComponent *, const FMeshRegionChangeBase *, bool > | This delegate fires when the mesh has been changed via an FMeshRegionChange-derived change FMeshChange, FMeshVertexChange, or FMeshReplacementChange Note that in the case of an FMeshVertexChange, the OnMeshVerticesChanged delegate will also fire | Components/DynamicMeshComponent.h |
| FMeshVerticesModified | TMulticastDelegate_ThreeParams< void, UDynamicMeshComponent *, const FMeshVertexChange *, bool > | This delegate fires when the mesh vertices have been changed via an FMeshVertexChange | Components/DynamicMeshComponent.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| UseDefaultTangentsType | EDynamicMeshComponentTangentsMode | Default what the 'Default' tangent type should map to. | Components/DynamicMeshComponent.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bDeferCollisionUpdates | bool | If true, updates to the mesh will not result in immediate collision regeneration. | Components/DynamicMeshComponent.h |
|
| bDisableMeshUVHitResults | bool | If true, UV hit results will not be enabled for this mesh's complex collision even if they are enabled for the project settings generally. | Components/DynamicMeshComponent.h |
|
| bEnableComplexCollision | bool | If true, current mesh will be used as Complex Collision source mesh. | Components/DynamicMeshComponent.h |
|
| bUseAsyncCooking | bool | Controls whether the physics cooking should be done off the game thread. | Components/DynamicMeshComponent.h |
|
| CollisionType | TEnumAsByte< enum ECollisionTraceFlag > | Type of Collision Geometry to use for this Mesh | Components/DynamicMeshComponent.h |
|
| OnChildAttachmentModified | FComponentChildrenChangedDelegate | The OnChildAttached() and OnChildDetached() implementations (from USceneComponent API) broadcast this delegate. | Components/DynamicMeshComponent.h | |
| OnMeshChanged | FSimpleMulticastDelegate | This delegate fires when the mesh has been changed | Components/DynamicMeshComponent.h | |
| OnMeshRegionChanged | FMeshRegionModified | Components/DynamicMeshComponent.h | ||
| OnMeshVerticesChanged | FMeshVerticesModified | Components/DynamicMeshComponent.h |
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bAllowsGeometrySelection | bool | If set to false, the geometry element selection UI will not be used for this mesh component. | Components/DynamicMeshComponent.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool AllowsGeometrySelection() |
Components/DynamicMeshComponent.h |
|
|
virtual void ClearSimpleCollisionShapes
(
bool bUpdateCollision |
Clear the simple collision shapes associated with this mesh component | Components/DynamicMeshComponent.h | |
virtual void ClearTriangleColorFunction
(
EDynamicMeshComponentRenderUpdateMode UpdateMode |
Clear an active triangle color function if one exists, and update the mesh | Components/DynamicMeshComponent.h | |
virtual void ClearVertexColorRemappingFunction
(
EDynamicMeshComponentRenderUpdateMode UpdateMode |
Clear an active VertexColor Remapping function if one exists, and update the mesh | Components/DynamicMeshComponent.h | |
void ConfigureMaterialSet
(
const TArray< UMaterialInterface* >& NewMaterialSet, |
Material Set API. DynamicMeshComponent supports changing the Material Set dynamically, even at Runtime. | Components/DynamicMeshComponent.h |
|
virtual bool ContainsPhysicsTriMeshData
(
bool InUseAllTriData |
Components/DynamicMeshComponent.h | ||
virtual void DisableSecondaryTriangleBuffers() |
Disable secondary triangle buffers. This invalidates the SceneProxy. | Components/DynamicMeshComponent.h | |
virtual void EditMesh
(
TFunctionRef< void(UE::Geometry::FDynamicMesh3&)> EditFunc, |
Allow external code to to edit the internal mesh. | Components/DynamicMeshComponent.h | |
void EnableComplexAsSimpleCollision() |
Physics APIs calls SetComplexAsSimpleCollisionEnabled(true, true) | Components/DynamicMeshComponent.h |
|
virtual void EnableSecondaryTriangleBuffers
(
TUniqueFunction< bool(const FDynamicMesh3*, int32)> SecondaryTriFilterFunc |
Support for Secondary triangle index buffers. | Components/DynamicMeshComponent.h | |
void FastNotifyColorsUpdated () |
Call this instead of NotifyMeshUpdated() if you have only updated the vertex colors (or triangle color function). | Components/DynamicMeshComponent.h | |
void FastNotifyPositionsUpdated
(
bool bNormals, |
Call this instead of NotifyMeshUpdated() if you have only updated the vertex positions (and possibly some attributes). | Components/DynamicMeshComponent.h | |
| Call this instead of NotifyMeshUpdated() if you have only updated secondary triangle sorting. | Components/DynamicMeshComponent.h | ||
void FastNotifyTriangleVerticesUpdated
(
const TArray< int32 >& Triangles, |
This function updates vertex positions/attributes of existing SceneProxy render buffers if possible, for the given triangles. | Components/DynamicMeshComponent.h | |
void FastNotifyTriangleVerticesUpdated
(
const TSet< int32 >& Triangles, |
This function updates vertex positions/attributes of existing SceneProxy render buffers if possible, for the given triangles. | Components/DynamicMeshComponent.h | |
void FastNotifyTriangleVerticesUpdated_ApplyPrecompute
(
const TArray< int32 >& Triangles, |
This function updates vertex positions/attributes of existing SceneProxy render buffers if possible, for the given triangles. | Components/DynamicMeshComponent.h | |
TFuture< bool > FastNotifyTriangleVerticesUpdated_TryPrecompute
(
const TArray< int32 >& Triangles, |
If a Decomposition is set on this Component, and everything is currently valid (proxy/etc), precompute the set of buffers that will be modified, as well as the bounds of the modified region. | Components/DynamicMeshComponent.h | |
void FastNotifyUVsUpdated () |
Call this instead of NotifyMeshUpdated() if you have only updated the vertex uvs. | Components/DynamicMeshComponent.h | |
void FastNotifyVertexAttributesUpdated
(
bool bNormals, |
Call this instead of NotifyMeshUpdated() if you have only updated the vertex attributes (but not positions). | Components/DynamicMeshComponent.h | |
void FastNotifyVertexAttributesUpdated
(
EMeshRenderAttributeFlags UpdatedAttributes |
Call this instead of NotifyMeshUpdated() if you have only updated the vertex positions/attributes This function will update the existing RenderProxy buffers if possible, rather than create new ones. | Components/DynamicMeshComponent.h | |
const UE::Geometry::FMeshTangentsf * GetAutoCalculatedTangents() |
Components/DynamicMeshComponent.h | ||
virtual const UBodySetup * GetBodySetup () |
Components/DynamicMeshComponent.h | ||
bool GetInvalidateProxyOnChangeEnabled() |
Components/DynamicMeshComponent.h | ||
virtual bool GetPhysicsTriMeshData
(
FTriMeshCollisionData* CollisionData, |
Components/DynamicMeshComponent.h | ||
virtual FDynamicMesh3 * GetRenderMesh () |
The SceneProxy should call these functions to get the post-processed RenderMesh. | Components/DynamicMeshComponent.h | |
virtual const FDynamicMesh3 * GetRenderMesh () |
The SceneProxy should call these functions to get the post-processed RenderMesh. | Components/DynamicMeshComponent.h | |
const FKAggregateGeom & GetSimpleCollisionShapes() |
Components/DynamicMeshComponent.h | ||
EDynamicMeshComponentTangentsMode GetTangentsType() |
Components/DynamicMeshComponent.h |
|
|
virtual bool GetTriMeshSizeEstimates
(
FTriMeshCollisionDataEstimates& OutTriMeshEstimates, |
Components/DynamicMeshComponent.h | ||
virtual bool HasTriangleColorFunction() |
Components/DynamicMeshComponent.h | ||
virtual bool HasVertexColorRemappingFunction() |
Components/DynamicMeshComponent.h | ||
virtual void InvalidateAutoCalculatedTangents() |
This function marks the auto tangents as dirty, they will be recomputed before they are used again | Components/DynamicMeshComponent.h | |
bool IsEditable () |
If set to false, this blocks external code from being able to modify the internal mesh. | Components/DynamicMeshComponent.h | |
virtual void NotifyMeshModified () |
RenderBuffer Update Blueprint API. | Components/DynamicMeshComponent.h |
|
virtual void NotifyMeshVertexAttributesModified
(
bool bPositions, |
Notify the Component that vertex attribute values of it's DynamicMesh have been modified externally. | Components/DynamicMeshComponent.h |
|
void SetAllowsGeometrySelection
(
bool bInAllowsGeometrySelection |
Enable/Disable interactive geometry element selection for the mesh. | Components/DynamicMeshComponent.h |
|
void SetComplexAsSimpleCollisionEnabled
(
bool bEnabled, |
If bEnabled=true, sets bEnableComplexCollision=true and CollisionType=CTF_UseComplexAsSimple If bEnabled=true, sets bEnableComplexCollision=false and CollisionType=CTF_UseDefault | Components/DynamicMeshComponent.h |
|
void SetDeferredCollisionUpdatesEnabled
(
bool bEnabled, |
Set value of bDeferCollisionUpdates, when enabled, collision is not automatically recomputed each time the mesh changes. | Components/DynamicMeshComponent.h |
|
void SetDynamicMesh
(
UDynamicMesh* NewMesh |
Replace the current UDynamicMesh with a new one, and transfer ownership of NewMesh to this Component. | Components/DynamicMeshComponent.h |
|
virtual void SetExternalDecomposition
(
TUniquePtr< FMeshRenderDecomposition > Decomposition |
Support for a Render Decomposition, which is basically a segmentation of the mesh triangles into subsets which will be turned into separate RenderBuffers in the Render Proxy. | Components/DynamicMeshComponent.h | |
void SetInvalidateProxyOnChangeEnabled
(
bool bEnabled |
When a FMeshChange or FMeshVertexChange is applied, by default we currently fully invalidate the render proxy. | Components/DynamicMeshComponent.h | |
void SetIsEditable
(
bool bInIsEditable |
Components/DynamicMeshComponent.h | ||
virtual void SetRenderMeshPostProcessor
(
TUniquePtr< IRenderMeshPostProcessor > Processor |
IRenderMeshPostProcessor Support. | Components/DynamicMeshComponent.h | |
void SetSceneProxyVerifyUsedMaterials
(
bool bState |
Set whether or not to validate mesh batch materials against the component materials. | Components/DynamicMeshComponent.h | |
virtual void SetSimpleCollisionShapes
(
const FKAggregateGeom& AggGeom, |
Update the simple collision shapes associated with this mesh component | Components/DynamicMeshComponent.h | |
void SetTangentsType
(
EDynamicMeshComponentTangentsMode NewTangentsType |
Components/DynamicMeshComponent.h |
|
|
void SetTransientDeferCollisionUpdates
(
bool bEnabled |
The bDeferCollisionUpdates property is a serialized Component setting that controls when collision is regenerated. | Components/DynamicMeshComponent.h | |
virtual void SetTriangleColorFunction
(
TUniqueFunction< FColor(const FDynamicMesh3*, int)> TriangleColorFuncIn, |
Support for specifying per-triangle colors as vertex colors. | Components/DynamicMeshComponent.h | |
virtual void SetVertexColorRemappingFunction
(
TUniqueFunction< void(FVector4f&)> ColorMapFuncIn, |
Support for Vertex Color remapping/filtering. | Components/DynamicMeshComponent.h | |
virtual void UpdateCollision
(
bool bOnlyIfPending |
Force an update of the Collision/Physics data for this Component. | Components/DynamicMeshComponent.h |
|
bool ValidateMaterialSlots
(
bool bCreateIfMissing, |
Compute the maximum MaterialID on the DynamicMesh, and ensure that Material Slots match. | Components/DynamicMeshComponent.h |
|
virtual bool WantsNegXTriMesh() |
Components/DynamicMeshComponent.h |
Overridden from UBaseDynamicMeshComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void ApplyTransform
(
const FTransform3d& Transform, |
Apply transform to internal mesh. In some cases this can be more efficient than a general edit. | Components/DynamicMeshComponent.h | |
virtual UDynamicMesh * GetDynamicMesh() |
Components/DynamicMeshComponent.h | ||
virtual const FDynamicMesh3 * GetMesh () |
Avoid usage of this function, access via GetDynamicMesh() instead | Components/DynamicMeshComponent.h | |
virtual FDynamicMesh3 * GetMesh () |
Mesh Access. | Components/DynamicMeshComponent.h | |
virtual void NotifyMeshUpdated () |
RenderBuffer Update API. | Components/DynamicMeshComponent.h | |
virtual void ProcessMesh
(
TFunctionRef< void(const UE::Geometry::FDynamicMesh3&)> ProcessFunc |
Allow external code to read the internal mesh. | Components/DynamicMeshComponent.h | |
virtual void SetMesh
(
UE::Geometry::FDynamicMesh3&& MoveMesh |
Initialize the internal mesh from a DynamicMesh | Components/DynamicMeshComponent.h |
Overridden from UPrimitiveComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual UBodySetup * GetBodySetup () |
Components/DynamicMeshComponent.h |
Overridden from IMeshVertexCommandChangeTarget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void ApplyChange
(
const FMeshVertexChange* Change, |
Change Support. | Components/DynamicMeshComponent.h |
Overridden from IMeshCommandChangeTarget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void ApplyChange
(
const FMeshChange* Change, |
Apply a general mesh change to the mesh | Components/DynamicMeshComponent.h |
Overridden from IMeshReplacementCommandChangeTarget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void ApplyChange
(
const FMeshReplacementChange* Change, |
Apply a mesh replacement change to mesh | Components/DynamicMeshComponent.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual UBodySetup * CreateBodySetupHelper() |
Components/DynamicMeshComponent.h | ||
virtual void FinishPhysicsAsyncCook
(
bool bSuccess, |
Once async physics cook is done, create needed state | Components/DynamicMeshComponent.h | |
FDynamicMeshSceneProxy * GetCurrentSceneProxy() |
Components/DynamicMeshComponent.h | ||
FColor GetGroupColor
(
const FDynamicMesh3* Mesh, |
This function is passed via lambda to the RenderProxy when BaseDynamicMeshComponent::ColorMode == Polygroups | Components/DynamicMeshComponent.h | |
FColor GetTriangleColor
(
const FDynamicMesh3* Mesh, |
This function is passed via lambda to the RenderProxy to be able to access TriangleColorFunc | Components/DynamicMeshComponent.h | |
virtual void InvalidatePhysicsData() |
Components/DynamicMeshComponent.h | ||
void OnMeshObjectChanged
(
UDynamicMesh* ChangedMeshObject, |
Called whenever internal MeshObject is modified, fires OnMeshChanged and OnMeshVerticesChanged above | Components/DynamicMeshComponent.h | |
virtual void OnNewDistanceFieldData_Async
(
TUniquePtr< FDistanceFieldVolumeData > NewData |
Components/DynamicMeshComponent.h | ||
virtual void RebuildPhysicsData() |
Components/DynamicMeshComponent.h | ||
void RemapVertexColor
(
FVector4f& VertexColorInOut |
This function is passed via lambda to the RenderProxy to be able to access VertexColorMappingFunc | Components/DynamicMeshComponent.h | |
void ResetProxy () |
Fully invalidate all rendering data for this Component. | Components/DynamicMeshComponent.h | |
virtual void SetBodySetup
(
UBodySetup* NewSetup |
Components/DynamicMeshComponent.h | ||
void UpdateAutoCalculatedTangents() |
Components/DynamicMeshComponent.h | ||
virtual void UpdateDistanceField() |
Components/DynamicMeshComponent.h | ||
void UpdateLocalBounds() |
Recompute LocalBounds from the current Mesh | Components/DynamicMeshComponent.h |
Overridden from UBaseDynamicMeshComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FBaseDynamicMeshSceneProxy * GetBaseSceneProxy() |
Subclass must implement this to return scene proxy if available, or nullptr | Components/DynamicMeshComponent.h | |
virtual void NotifyMaterialSetUpdated () |
This is called to tell our RenderProxy about modifications to the material set. | Components/DynamicMeshComponent.h |
Overridden from UPrimitiveComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FPrimitiveSceneProxy * CreateSceneProxy() |
Components/DynamicMeshComponent.h |
Overridden from USceneComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FBoxSphereBounds CalcBounds
(
const FTransform& LocalToWorld |
Components/DynamicMeshComponent.h | ||
virtual void OnChildAttached
(
USceneComponent* ChildComponent |
Components/DynamicMeshComponent.h | ||
virtual void OnChildDetached
(
USceneComponent* ChildComponent |
Components/DynamicMeshComponent.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BeginDestroy() |
Components/DynamicMeshComponent.h | ||
virtual void PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Components/DynamicMeshComponent.h | ||
virtual void PostEditImport() |
Components/DynamicMeshComponent.h | ||
virtual void PostLoad() |
Components/DynamicMeshComponent.h | ||
virtual void Serialize
(
FArchive& Ar |
Components/DynamicMeshComponent.h |