Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Might be a dumb question
#3
(28-04-2022, 11:02 PM)josemendez Wrote: HI there!

"Scripting particles" refers to the act of controlling particles via script. It's not the name of a thing Sonrisa.

Particles are not classes or structs. Obi uses a data-oriented approach, which means particles are just an index, that you can use to access data in several arrays of the same length. Quoting the manual:


So to access the position of the Nth particle in a cloth, you do:

Code:
var pos = solver.positions[cloth.solverIndices[N]];

Similarly, to access its velocity:

Code:
var pos = solver.velocities[cloth.solverIndices[N]];


FYI, Unity's DOTS (data-oriented technology stack) uses the same approach: entities are not classes or structs, an entity is just an index into arrays of components.

The main advantage of this approach is the ability to deal with large amounts of data in a very performant way, because cache misses are minimized and memory is used efficiently: when you need to operate over say, particle positions and velocities, you *only* operate on that. No need to bring single every property from memory (mass, radius, color, etc) like you'd be forced to do if particles were structs - since you could not have partial access to a particle.


Orientations are only used by some actors, and cloth isn't one of them: cloth particles are just points in space with no orientation.

Currently, only rods (ObiRope) and soft bodies (ObiSoftbody) use oriented particles.


kind regards,

Thanks for the explanation!

I'm trying to implement a cutting algorithm, find a list of pairs of particles connected by DistanceConstraints that are as close as along a given straight line. I think that I need the particle orientation to determine if two particles connected by a DistanceConstraint don't have any "mesh gap" between them. Because my mesh has two sides that are close to each other, and I'm worrying that Obi will create constraints from the outside vertices to the inside vertices.

If Obi won't create DistanceConstraint between two cloth particles if there is "mesh gap" between them, then I probably don't need the particle orientation.

Or, is it possible to get the mesh vertex index for a corresponding particle/closest to a particle? Maybe I can resolve my issue if I can get the vertex information.
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