Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Might be a dumb question
#9
(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!
Reply


Messages In This Thread
Might be a dumb question - by snowtv - 28-04-2022, 08:31 PM
RE: Might be a dumb question - by josemendez - 28-04-2022, 11:02 PM
RE: Might be a dumb question - by snowtv - 29-04-2022, 03:58 PM
RE: Might be a dumb question - by josemendez - 02-05-2022, 08:52 PM
RE: Might be a dumb question - by snowtv - 03-05-2022, 08:24 PM
RE: Might be a dumb question - by josemendez - 04-05-2022, 09:48 AM
RE: Might be a dumb question - by snowtv - 05-05-2022, 07:49 PM
RE: Might be a dumb question - by josemendez - 06-05-2022, 08:01 AM
RE: Might be a dumb question - by snowtv - 11-05-2022, 04:37 PM
RE: Might be a dumb question - by snowtv - 12-05-2022, 09:39 PM
RE: Might be a dumb question - by josemendez - 13-05-2022, 09:05 AM