Help Cloth scripted particle attachment in runtime - 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 Cloth scripted particle attachment in runtime (/thread-2639.html) |
Cloth scripted particle attachment in runtime - ben_monash - 17-12-2020 Hi, I am trying to simulate cloth manipulation in Unity 2019.6.16 and Obi Cloth 5. Currently, I am attaching a sphere to a particle group on the cloth and have written a script allowing me to control the sphere with my mouse (images below). I want to be able to grasp (click) anywhere on the cloth and manipulate it, and I know there is a better way than creating a few hundred spheres and attaching them individually to each particle in the cloth. My issue is that I am fairly new to Unity and Obi Cloth, and I am totally stuck on how to script this type of interaction. Specifically, I am not quite sure where to start, should I be modifying the "ObiParticleAttachment.cs" associated with the cloth, or should I create a new .cs file? If I create a new .cs file then how do I access/reference my cloth and its "Obi Particle Attachment" component? Thanks, Ben RE: Cloth scripted particle attachment in runtime - josemendez - 17-12-2020 Hi Ben, There's a sample component that let you click on any actor and drag it around: ObiParticleDragger. When you add a ObiParticleDragger, a ObiParticlePicker will also be added as a dependency. The picker raycasts against all particles and raises events for particle click/drag/release. The dragger subscribes to these events and applies spring forces to move the picked particle(s) around. RE: Cloth scripted particle attachment in runtime - ben_monash - 20-12-2020 (17-12-2020, 09:01 AM)josemendez Wrote: Hi Ben, Hi Jose, Thanks for the suggestion and the very quick reply, that component is exactly what I was looking for! Thanks, Ben |