UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IClothingSimulationInterface Class Referenceabstract

#include <ClothingSimulationInterface.h>

Public Member Functions

UE_API IClothingSimulationInterface ()
 
virtual UE_API ~IClothingSimulationInterface ()
 
PRAGMA_DISABLE_DEPRECATION_WARNINGS const IClothingSimulationDynamicCastToIClothingSimulation () const
 
IClothingSimulationDynamicCastToIClothingSimulation ()
 
virtual PRAGMA_ENABLE_DEPRECATION_WARNINGS int32 GetNumCloths () const
 
virtual int32 GetNumKinematicParticles () const
 
virtual int32 GetNumDynamicParticles () const
 
virtual int32 GetNumIterations () const
 
virtual int32 GetNumSubsteps () const
 
virtual float GetSimulationTime () const
 
virtual bool IsTeleported () const
 

Protected Member Functions

virtual void CreateActor (USkeletalMeshComponent *InOwnerComponent, const UClothingAssetBase *InAsset, int32 SimDataIndex)=0
 
virtual void EndCreateActor ()=0
 
virtual IClothingSimulationContextCreateContext ()=0
 
virtual void FillContextAndPrepareTick (const USkeletalMeshComponent *InComponent, float InDeltaTime, IClothingSimulationContext *InOutContext, bool bIsInitialization, bool bForceTeleportResetOnly)=0
 
virtual void Initialize ()=0
 
virtual void Shutdown ()=0
 
virtual bool ShouldSimulateLOD (int32 OwnerLODIndex) const =0
 
virtual void Simulate_AnyThread (const IClothingSimulationContext *InContext)=0
 
virtual void ForceClothNextUpdateTeleportAndReset_AnyThread ()=0
 
virtual void HardResetSimulation (const IClothingSimulationContext *InContext)=0
 
virtual void DestroyActors ()=0
 
virtual void DestroyContext (IClothingSimulationContext *InContext)=0
 
virtual void AppendSimulationData (TMap< int32, FClothSimulData > &InOutData, const USkeletalMeshComponent *OwnerComponent, const USkinnedMeshComponent *OverrideComponent) const =0
 
virtual FBoxSphereBounds GetBounds (const USkeletalMeshComponent *InOwnerComponent) const =0
 
virtual void AddExternalCollisions (const FClothCollisionData &InData)=0
 
virtual void ClearExternalCollisions ()=0
 
virtual void GetCollisions (FClothCollisionData &OutCollisions, bool bIncludeExternal=true) const =0
 

Friends

struct FClothingSimulationInstance
 
class IClothingSimulation
 

Detailed Description

Base class for clothing simulators.

The majority of the API for this class is protected. For the most part the simulation is not designed to be used outside of the FClothingSimulationInstance implementation which is used in the Skeletal Mesh Component, as its parallel simulation is tied to the Skeletal Mesh Component tick and dependents. Any method that is available in the public section below should consider that it may be called while the simulation is running.

Constructor & Destructor Documentation

◆ IClothingSimulationInterface()

IClothingSimulationInterface::IClothingSimulationInterface ( )
default

◆ ~IClothingSimulationInterface()

IClothingSimulationInterface::~IClothingSimulationInterface ( )
virtualdefault

Member Function Documentation

◆ AddExternalCollisions()

virtual void IClothingSimulationInterface::AddExternalCollisions ( const FClothCollisionData InData)
protectedpure virtual

Called by the engine when an external object wants to inject collision data into this simulation above and beyond what is specified in the asset for the internal actors Examples: Scene collision, collision for parents we are attached to

Parameters
InData- Collisions to add to this simulation

◆ AppendSimulationData()

virtual void IClothingSimulationInterface::AppendSimulationData ( TMap< int32, FClothSimulData > &  InOutData,
const USkeletalMeshComponent *  OwnerComponent,
const USkinnedMeshComponent OverrideComponent 
) const
protectedpure virtual

Fill FClothSimulData map for the clothing simulation. Should fill a map pair per-actor. Do not remove InOutData elements which you are not responsible for: they may have been written by a different instance.

Parameters
InOutData- The simulation data to write to
OwnerComponent- the component that owns the simulation
OverrideComponent- An override component if bound to a leader pose component

◆ ClearExternalCollisions()

virtual void IClothingSimulationInterface::ClearExternalCollisions ( )
protectedpure virtual

Called by the engine when external collisions are no longer necessary or when they need to be updated with some of the previous collisions removed. It is recommended in derived simulations to avoid freeing any allocations regarding external collisions as it is likely more will be added soon after this call

◆ CreateActor()

virtual void IClothingSimulationInterface::CreateActor ( USkeletalMeshComponent *  InOwnerComponent,
const UClothingAssetBase InAsset,
int32  SimDataIndex 
)
protectedpure virtual

Create an actor for this simulation from the data in InAsset Simulation data for this actor should be written back to SimDataIndex in GetSimulationData

Parameters
InOwnerComponent- The component requesting this actor
InAsset- The asset to create an actor from
SimDataIndex- the sim data index to use when doing the writeback in AppendSimulationData

◆ CreateContext()

virtual IClothingSimulationContext * IClothingSimulationInterface::CreateContext ( )
protectedpure virtual

Create a new context, will not be filled, call FillContextAndPrepareTick before simulating with this context

◆ DestroyActors()

virtual void IClothingSimulationInterface::DestroyActors ( )
protectedpure virtual

Simulation should remove all of it's actors when next possible and free them

◆ DestroyContext()

virtual void IClothingSimulationInterface::DestroyContext ( IClothingSimulationContext InContext)
protectedpure virtual

Destroy a context object, engine will always pass a context created using CreateContext

Parameters
InContext- The context to destroy

◆ DynamicCastToIClothingSimulation() [1/2]

IClothingSimulation * IClothingSimulationInterface::DynamicCastToIClothingSimulation ( )
inline

◆ DynamicCastToIClothingSimulation() [2/2]

PRAGMA_DISABLE_DEPRECATION_WARNINGS const IClothingSimulation * IClothingSimulationInterface::DynamicCastToIClothingSimulation ( ) const
inline

◆ EndCreateActor()

virtual void IClothingSimulationInterface::EndCreateActor ( )
protectedpure virtual

Called once all CreateActor have been called.

◆ FillContextAndPrepareTick()

virtual void IClothingSimulationInterface::FillContextAndPrepareTick ( const USkeletalMeshComponent *  InComponent,
float  InDeltaTime,
IClothingSimulationContext InOutContext,
bool  bIsInitialization,
bool  bForceTeleportResetOnly 
)
protectedpure virtual

Fills an existing context for a single simulation step and do any other work that needs to be called by the engine on the game thread prior to simulation.

Parameters
InComponent- The component to fill the context for
InOutContext- The context to fill
bIsInitialization- Whether this fill is occurring as part of the actor creation stage
bForceTeleportResetOnly- Whether ForceClothNextUpdateTeleportAndReset instead of Simulate and AppendSimulationData will be called.

◆ ForceClothNextUpdateTeleportAndReset_AnyThread()

virtual void IClothingSimulationInterface::ForceClothNextUpdateTeleportAndReset_AnyThread ( )
protectedpure virtual

Called instead of Simulate when not ticking.

Note
Can be called asynchronously outside of the game thread.

◆ GetBounds()

virtual FBoxSphereBounds IClothingSimulationInterface::GetBounds ( const USkeletalMeshComponent *  InOwnerComponent) const
protectedpure virtual

Get the bounds of the simulation mesh in local simulation space

◆ GetCollisions()

virtual void IClothingSimulationInterface::GetCollisions ( FClothCollisionData OutCollisions,
bool  bIncludeExternal = true 
) const
protectedpure virtual

Called by the engine to request data on all active collisions in a simulation. if bIncludeExternal is true, derived implementations should add the asset collisions and any collisions added at runtime, if false only the collisions from the asset should be considered

Parameters
OutCollisions- Array to write collisions to
bIncludeExternal- Whether or not external collisions should be retrieved, or just asset collisions

◆ GetNumCloths()

virtual PRAGMA_ENABLE_DEPRECATION_WARNINGS int32 IClothingSimulationInterface::GetNumCloths ( ) const
inlinevirtual

Return the number of simulated cloths. Implementation must be thread safe.

◆ GetNumDynamicParticles()

virtual int32 IClothingSimulationInterface::GetNumDynamicParticles ( ) const
inlinevirtual

Return the number of dynamic (simulated) particles. Implementation must be thread safe.

◆ GetNumIterations()

virtual int32 IClothingSimulationInterface::GetNumIterations ( ) const
inlinevirtual

Return the number of iterations used by the solver. This is the maximum used as an indicative value only, as this could vary between cloths. Implementation must be thread safe.

◆ GetNumKinematicParticles()

virtual int32 IClothingSimulationInterface::GetNumKinematicParticles ( ) const
inlinevirtual

Return the number of kinematic (fixed) particles. Implementation must be thread safe.

◆ GetNumSubsteps()

virtual int32 IClothingSimulationInterface::GetNumSubsteps ( ) const
inlinevirtual

Return the number of substeps used by the solver. This is the maximum used as an indicative value only, as this could vary between cloths. Implementation must be thread safe.

◆ GetSimulationTime()

virtual float IClothingSimulationInterface::GetSimulationTime ( ) const
inlinevirtual

Return the simulation time in ms. Implementation must be thread safe.

◆ HardResetSimulation()

virtual void IClothingSimulationInterface::HardResetSimulation ( const IClothingSimulationContext InContext)
protectedpure virtual

Hard reset the simulation without necessarily recreating cloth actors.

◆ Initialize()

virtual void IClothingSimulationInterface::Initialize ( )
protectedpure virtual

Initialize the simulation, will be called before any Simulate calls

◆ IsTeleported()

virtual bool IClothingSimulationInterface::IsTeleported ( ) const
inlinevirtual

Return whether the simulation is teleported. Implementation must be thread safe.

◆ ShouldSimulateLOD()

virtual bool IClothingSimulationInterface::ShouldSimulateLOD ( int32  OwnerLODIndex) const
protectedpure virtual

Called by the engine to determine if this simulation can run this tick at this LOD. ForceClothNextUpdateTeleportAndReset rather than Simulate and AppendSimulationData will be called this tick.

◆ Shutdown()

virtual void IClothingSimulationInterface::Shutdown ( )
protectedpure virtual

Shutdown the simulation, this should clear ALL resources as we no longer expect to call any other function on this simulation without first calling Initialize again.

◆ Simulate_AnyThread()

virtual void IClothingSimulationInterface::Simulate_AnyThread ( const IClothingSimulationContext InContext)
protectedpure virtual

Run a single tick of the simulation. The pointer InContext is guaranteed (when called by the engine) to be the context allocated in CreateContext and can be assumed to be safely castable to any derived type allocated there. New callers should take care to make sure only the correct context is ever passed through.

Note
Can be called asynchronously outside of the game thread.
Parameters
InContext- The context to use during simulation, will have been filled in FillContextAndPrepareTick

Friends And Related Symbol Documentation

◆ FClothingSimulationInstance

◆ IClothingSimulation

friend class IClothingSimulation
friend

The documentation for this class was generated from the following files: