Copy position from one rope to another - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html) +--- Thread: Copy position from one rope to another (/thread-3275.html) Pages:
1
2
|
RE: Copy position from one rope to another - lufydad - 31-01-2022 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++) 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 ? Moreover, to get the array of activeParticles in obi solvers I had to change the code of the ObiSolver.cs and move activeParticles from private to public. It's a bit dirty... is there another way to get this array ? RE: Copy position from one rope to another - josemendez - 31-01-2022 (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 : 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. RE: Copy position from one rope to another - lufydad - 31-01-2022 (31-01-2022, 05:14 PM)josemendez Wrote: 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. It seems to work better, thanks |