Obi Official Forum
Help Rope Reference from ObiParticlePicker - 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: Help Rope Reference from ObiParticlePicker (/thread-4007.html)



Rope Reference from ObiParticlePicker - littleanchovy - 22-09-2023

Hello, i am using obi particle picker component to move my rope with mouse cursors, how can i get the picked rope reference from that component to use events like OnParticleDragged,OnParticleHeld ?


RE: Rope Reference from ObiParticlePicker - josemendez - 22-09-2023

(22-09-2023, 09:46 AM)littleanchovy Wrote: Hello, i am using obi particle picker component to move my rope with mouse cursors, how can i get the picked rope reference from that component to use events like OnParticleDragged,OnParticleHeld ?

Given the index of the particle in the solver (which is passed to OnParticleDragged/Held), you can do:

Code:
ObiSolver.ParticleInActor pa = solver.particleToActor[particleIndex];
var rope = pa.actor as ObiRope;

See: http://obi.virtualmethodstudio.com/manual/6.3/scriptingparticles.html


RE: Rope Reference from ObiParticlePicker - littleanchovy - 22-09-2023

(22-09-2023, 09:46 AM)littleanchovy Wrote: Hello, i am using obi particle picker component to move my rope with mouse cursors, how can i get the picked rope reference from that component to use events like OnParticleDragged,OnParticleHeld ?
thank you !