Help particle like obiactor - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html) +--- Thread: Help particle like obiactor (/thread-3389.html) |
particle like obiactor - maygdirf - 01-04-2022 Hi again! I was wondering if it's possible to treat each particle of a ObiCloth like a ObiActor, so move them in a desired position for example. In particular, I would like doing a suturing task like the medical procedure in which the two parts of a wound have to enlace using a rope. Thanks in advice. RE: particle like obiactor - josemendez - 03-04-2022 (01-04-2022, 04:09 PM)maygdirf Wrote: Hi again! Hi there, You can both get and set any individual per-particle property (such as position, velocity, mass, etc) using the particles API: http://obi.virtualmethodstudio.com/manual/6.3/scriptingparticles.html kind regards, RE: particle like obiactor - maygdirf - 04-04-2022 (03-04-2022, 12:48 PM)josemendez Wrote: Hi there, Clear! But to set a desired position, I have to make a transformation from the solver to the global space, right? RE: particle like obiactor - josemendez - 04-04-2022 (04-04-2022, 02:44 PM)maygdirf Wrote: Clear! But to set a desired position, I have to make a transformation from the solver to the global space, right? Right. All properties in Obi are expressed in the solver's local space, so you have to do the required conversions. Unity's Transform/InverseTransform family of functions do the job nicely. For instance, to take a position from solver's local space to world space, you'd use: https://docs.unity3d.com/ScriptReference/Transform.TransformPoint.html RE: particle like obiactor - maygdirf - 04-04-2022 (04-04-2022, 02:54 PM)josemendez Wrote: Right. All properties in Obi are expressed in the solver's local space, so you have to do the required conversions.I have to use the renderablePosition or the "classic" one? RE: particle like obiactor - josemendez - 04-04-2022 (04-04-2022, 04:47 PM)maygdirf Wrote: I have to use the renderablePosition or the "classic" one? It depends on what you want to do. As the name implies, "renderablePositions" are used exclusively for rendering. Modifying them has no impact on the simulation, as they are reset to the (possibly interpolated, depending on your settings) regular positions right after simulation has finished each frame. Regular "positions" are the ones used for the simulation. To sum up: If you want to physically move particles around, use positions. If you're only interested in "post-processing" positions every frame, use renderablePositions. |