11-05-2022, 04:37 PM
(06-05-2022, 08:01 AM)josemendez Wrote: Yes, this does get updated at runtime.
This isn't really documented anywhere, as it's very low-level stuff: to generate cloth from a mesh, Obi uses a half-edge data structure. You can find the implementation in HalfEdgeMesh.cs file. The half-edge structure contains a rawToWelded array with as many entries as vertices in your mesh. For each vertex, it contains the index of the actor particle that represents that vertex.
The cloth blueprint has a public "topology" member, which is of type HalfEdgeMesh.
Tearable cloth actors create a copy of their blueprint at runtime, since they need to modify the topology (the half-edge structure) so they can't share the same blueprint, unlike other cloth types. This copy gets updated every time the cloth is torn, as I mentioned above.
Wrapping up: to get the particle for vertex N at runtime, do:
Code:int actorParticleIndex = cloth.blueprint.topology.rawToWelded[N];
Great! Thank you so much for the info!