01-02-2022, 10:02 AM
(This post was last modified: 01-02-2022, 10:03 AM by josemendez.)
(01-02-2022, 07:39 AM)MoonBoop Wrote: Im not quite sure why the sack generator works in the way it does since it still seems to be relying on the logic that was used to build the mesh and not fetching the particles that are in the right positions to stitch.
The mesh created by the sack generator is guaranteed to have one particle per vertex, and in the exact same order, since it has no normal/color/uv seams.
When you create a mesh, multiple vertices may share the same position but have different normals, uv coordinates, colors, etc. This is very common. When generating particles from a mesh, Obi welds together vertices that have the same position, and generates a single particle for all of them. Because of this there is not a 1-1 relationship between vertices and particles, some particles represent multiple vertices. Otherwise there would be "cuts" in the cloth whenever there's a discontinuity in any vertex property.
In the general case, you need to use particles and forget about mesh vertices. Vertices should only be used for rendering, and particles only used for physics. The best way to access particles is the pattern explained in the manual:
http://obi.virtualmethodstudio.com/manua...icles.html
Code:
// index of the first particle in the actor:
int actorIndex = 0;
// solver index of the first particle in the actor.
int solverIndex = actor.solverIndices[actorIndex];
// use it to get the particle's current velocity. (or position, or mass, radius, etc)
Vector3 velocity = solver.velocities[solverIndex];