visualMesh
The dynamically deforming visual mesh of the cloth body, which you may read but not modify.
Declaration
var visualMesh: LowLevelMesh? { get }Discussion
This visual mesh will always be nil at first. The visual mesh becomes non-nil if the entity is part of a simulation and has a ModelComponent whose mesh is not a LowLevelMesh. This is a dynamically deforming version of the mesh stored in the ModelComponent, and overrides the rendering.
The visual mesh is updated on the GPU after each simulation update. Subscribe to ClothSimulationEvents.AfterUpdate to know when new data is available. To read the mesh contents on the GPU, encode your work using the scene’s commandQueue to ensure proper synchronization with the simulation’s GPU writes.