Class Cloth
Physical simulation actor for cloth objects made of vertices that are simulated as cloth particles with physical properties, forces, and constraints to affect cloth behavior.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Physics/Actors/Cloth.h
Syntax
public class Cloth : public Actor
Methods
BeginPlay(SceneBeginData* data)
Called when adding object to the game.
Declaration
protected virtual void BeginPlay(SceneBeginData* data) override
Parameters
SceneBeginData
data
The initialization data (e.g. used to collect joints to link after begin). |
Overrides
ClearInteria()
Sets the inertia derived from transform change to zero (once). It will reset any cloth object movement effects as it was teleported.
Declaration
public void ClearInteria()
Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
Deserializes object from the input stream.
Declaration
public virtual void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override
Parameters
DeserializeStream
stream
The input stream. |
ISerializeModifier
modifier
The deserialization modifier object. Always valid. |
Overrides
Draw(RenderContext& renderContext)
Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. geometry is rendered during all pass types but other actors are drawn only during GBufferFill pass).
Declaration
public virtual void Draw(RenderContext& renderContext) override
Parameters
RenderContext
renderContext
The rendering context. |
Overrides
Draw(RenderContextBatch& renderContextBatch)
Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. geometry is rendered during all pass types but other actors are drawn only during GBufferFill pass).
Declaration
public virtual void Draw(RenderContextBatch& renderContextBatch) override
Parameters
RenderContextBatch
renderContextBatch
The rendering context batch (eg, main view and shadow projections). |
Overrides
EndPlay()
Called when removing object from the game.
Declaration
protected virtual void EndPlay() override
Overrides
GetCollision()
Gets the cloth response to collisions settings.
Declaration
public CollisionSettings GetCollision() const
Returns
CollisionSettings
|
GetFabric()
Gets the cloth's fabric settings (material's stiffness and compression response).
Declaration
public FabricSettings GetFabric() const
Returns
FabricSettings
|
GetForce()
Gets the cloth response to forces settings.
Declaration
public ForceSettings GetForce() const
Returns
ForceSettings
|
GetMesh()
Gets the mesh to use for the cloth simulation (single mesh from specific LOD). Always from the parent static or animated model actor.
Declaration
public ModelInstanceActor::MeshReference GetMesh() const
Returns
ModelInstanceActor::MeshReference
|
GetPaint()
Gets the cloth particles paint data with per-particle max distance (normalized 0-1, 0 makes particle immovable). Returned value is empty if cloth was not initialized or doesn't use paint feature.
Declaration
public Span<float> GetPaint() const
Returns
Span<float>
|
GetParticles()
Gets the cloth particles data with per-particle XYZ position (in local cloth-space).
Declaration
public Array<Float3> GetParticles() const
Returns
Array<Float3>
|
GetPhysicsCloth()
Gets the native physics backend object.
Declaration
public void* GetPhysicsCloth() const
Returns
void
|
GetSimulation()
Gets the cloth simulation settings.
Declaration
public SimulationSettings GetSimulation() const
Returns
SimulationSettings
|
IntersectsItself(const Ray& ray, Real& distance, Vector3& normal)
Determines if there is an intersection between the current object and a ray.
Declaration
public virtual bool IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) override
Parameters
Ray
ray
The ray to test. |
Real
distance
When the method completes, contains the distance of the intersection (if any valid). |
Vector3
normal
When the method completes, contains the intersection surface normal vector (if any valid). |
Returns
bool
True whether the two objects intersected, otherwise false. |
Overrides
OnDebugDrawSelected()
Draws debug shapes for the selected actor and all child scripts.
Declaration
protected virtual void OnDebugDrawSelected() override
Overrides
OnDeleteObject()
Deletes the object. Called by the ObjectsRemovalService. Can be overriden to provide custom logic per object (cleanup, etc.).
Declaration
protected virtual void OnDeleteObject() override
Overrides
OnDisable()
Called when actor gets removed from game systems. Occurs on EndPlay event or when actor gets inactivated in hierarchy. Use this event to unregister object from other game system (eg. audio).
Declaration
protected virtual void OnDisable() override
Overrides
OnEnable()
Called when actor gets added to game systems. Occurs on BeginPlay event or when actor gets activated in hierarchy. Use this event to register object to other game system (eg. audio).
Declaration
protected virtual void OnEnable() override
Overrides
OnParentChanged()
Called when actor parent gets changed.
Declaration
protected virtual void OnParentChanged() override
Overrides
OnPhysicsSceneChanged(PhysicsScene* previous)
Declaration
protected virtual void OnPhysicsSceneChanged(PhysicsScene* previous) override
Parameters
PhysicsScene
previous
|
Overrides
OnPostUpdate()
Declaration
public void OnPostUpdate()
OnPreUpdate()
Declaration
public bool OnPreUpdate()
Returns
bool
|
OnTransformChanged()
Called when actor transform gets changed.
Declaration
protected virtual void OnTransformChanged() override
Overrides
Rebuild()
Recreates the cloth by removing current instance data and creating a new physical cloth object.
Declaration
public void Rebuild()
Serialize(SerializeStream& stream, const void* otherObj)
Serializes object to the output stream compared to the values of the other object instance (eg. default class object). If other object is null then serialize all properties.
Declaration
public virtual void Serialize(SerializeStream& stream, const void* otherObj) override
Parameters
SerializeStream
stream
The output stream. |
void
otherObj
The instance of the object to compare with and serialize only the modified properties. If null, then serialize all properties. |
Overrides
SetCollision(const CollisionSettings& value)
Sets the cloth response to collisions settings.
Declaration
public void SetCollision(const CollisionSettings& value)
Parameters
CollisionSettings
value
|
SetFabric(const FabricSettings& value)
Sets the cloth's fabric settings (material's stiffness and compression response).
Declaration
public void SetFabric(const FabricSettings& value)
Parameters
FabricSettings
value
|
SetForce(const ForceSettings& value)
Sets the cloth response to forces settings.
Declaration
public void SetForce(const ForceSettings& value)
Parameters
ForceSettings
value
|
SetMesh(const ModelInstanceActor::MeshReference& value)
Sets the mesh to use for the cloth simulation (single mesh from specific LOD). Always from the parent static or animated model actor.
Declaration
public void SetMesh(const ModelInstanceActor::MeshReference& value)
Parameters
ModelInstanceActor::MeshReference
value
|
SetPaint(Span<const float> value)
Sets the cloth particles paint data with per-particle max distance (normalized 0-1, 0 makes particle immovable). The size of the input data had to match the cloth size. Set to empty to remove paint.
Declaration
public void SetPaint(Span<const float> value)
Parameters
Span<float>
value
|
SetParticles(Span<const Float3> value)
Sets the cloth particles data with per-particle XYZ position (in local cloth-space). The size of the input data had to match the cloth size.
Declaration
public void SetParticles(Span<const Float3> value)
Parameters
Span<Float3>
value
|
SetSimulation(const SimulationSettings& value)
Sets the cloth simulation settings.
Declaration
public void SetSimulation(const SimulationSettings& value)
Parameters
SimulationSettings
value
|