Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove / add particle attachment at runtime?
#1
Hi, I'd be interested in removing or adding particle attachments from ropes at runtime. Is this possible? Or could this be done by adding a rigidbody and a normal Unity joint to use as a proxy?
Reply
#2
(29-07-2020, 03:06 PM)Lockpickle Wrote: Hi, I'd be interested in removing or adding particle attachments from ropes at runtime. Is this possible? Or could this be done by adding a rigidbody and a normal Unity joint to use as a proxy?

Sure, simply add a ObiParticleAttachment component as you would with any other component, and set its target and particle group attributes to whatever you need. To remove it simply destroy the component.

let me know if you need help with this.
Reply
#3
(31-07-2020, 12:23 PM)josemendez Wrote: Sure, simply add a ObiParticleAttachment component as you would with any other component, and set its target and particle group attributes to whatever you need. To remove it simply destroy the component.

let me know if you need help with this.

Thanks! This didn't seem to work when I tried it, but maybe I had something wrong. I did get it working eventually using a proxy object. But also, what if I want to attach something to a part of the rope other than a control point, can I somehow add a particle group dynamically?
Reply
#4
(31-07-2020, 04:05 PM)Lockpickle Wrote: Thanks! This didn't seem to work when I tried it, but maybe I had something wrong. I did get it working eventually using a proxy object. But also, what if I want to attach something to a part of the rope other than a control point, can I somehow add a particle group dynamically?

Yes, a particle group is simply a scriptable object that contains a list of particle indices. You can create one (using CreateInstance, the usual way for scriptable objects) and populate its particleIndices list with the indices of the particles you want to attach. Then, assign it to the attachment.
Reply