31-01-2022, 05:14 PM
(This post was last modified: 31-01-2022, 05:17 PM by josemendez.)
(31-01-2022, 04:42 PM)lufydad Wrote: I'm having a problem using the method describe above with multiple ropes. To summarize briefly, I use copy all the positions of active particles in a given obi solver (solver 0) and I apply these positions in another solver (solver 1) using this way :
Code:for(int i=0; i<nbrActiveParticles;i++)
solver1.positions[solver1.activeParticles[i]] = solver0.positions[solver0.activeParticles[i]];
But with multiples ropes, it seems like the ropes must be joined together... Like on this capture : https://imgur.com/a/0Xtm2Tq (on top it corresponds to the bug and bellow to the normal positions)
Is there some parameters that I need to check for render in solvers ?
This approach won’t work, because there’s no guarantee that particle #N in the first solver will be the same as particle #N in the second solver (they might even belong to different actors). Particles are allocated to actors as they get added to the solver, this happens using standard Unity callbacks (OnEnable, Awake, etc) and callback order in Unity for different objects is undefined.
If you want to copy particle positions, do it on a per-actor basis. That’s what the actor.solverIndices array is for.