Obi Official Forum
Help Multiple Particle Attachment ? - 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 Multiple Particle Attachment ? (/thread-2526.html)



Multiple Particle Attachment ? - VincentAbert - 07-10-2020

Hello !

I just wanted to make sure that there was no problem with using multiple particle attachment components on a single particle group. I am also not sure about how to set the particle group by script, how can I choose it by name for example ?

I have a ton of other questions, but I'll try and search a bit more in the docs before flooding the forum Sonrisa

I hope I made myself clear, english is not my first language.

Cheers,

Vincent


RE: Multiple Particle Attachment ? - josemendez - 08-10-2020

Hi Vincent,

Attaching the same particle group to multiple transforms doesn't make any sense. Just like it doesn't make sense to have a transform with multiple parents (in fact, this isn't possible in any transform hierarchy implementation that I know of). What's your use case for this?

The manual specifies that in case of multiple attachments for the same particle, the result is undefined:
http://obi.virtualmethodstudio.com/tutorials/attachments.html

Quote:Particles affected by more than one attachment will follow the attachment that was updated last. The update order for attachment is undefined.

Particle groups are stored in a plain generic List<>. So you can access by index just like you would any other list:
Code:
var particleGroup = rope.blueprint.groups[index];

If you want to access them by name, you have to perform a linear search:
Code:
public ObiParticleGroup GetGroupByName(string name)
    {
        foreach (var group in rope.blueprint.groups)
            if (group.name == name)
                return group;
        return null;
    }



RE: Multiple Particle Attachment ? - VincentAbert - 08-10-2020

(08-10-2020, 08:00 AM)josemendez Wrote: Hi Vincent,

Attaching the same particle group to multiple transforms doesn't make any sense. Just like it doesn't make sense to have a transform with multiple parents (in fact, this isn't possible in any transform hierarchy implementation that I know of). What's your use case for this?

The manual specifies that in case of multiple attachments for the same particle, the result is undefined:
http://obi.virtualmethodstudio.com/tutorials/attachments.html


Particle groups are stored in a plain generic List<>. So you can access by index just like you would any other list:
Code:
var particleGroup = rope.blueprint.groups[index];

If you want to access them by name, you have to perform a linear search:
Code:
public ObiParticleGroup GetGroupByName(string name)
    {
        foreach (var group in rope.blueprint.groups)
            if (group.name == name)
                return group;
        return null;
    }

Thanks a lot for the response Jose !

For my use case, I guess I was not clear enough, my bad. I made a video to make it more obvious. https://www.youtube.com/watch?v=cNQflI6b5IQ

I have a rope, at the end of which is a "hook" (symbolised here by the sphere that the character picks up) . Now that hook is already a dynamic particle attachment for the rope. But then I would like to attach a crate at the end oh the rope, in such a way that I can then drag that box around.
What you see in the video is a solution I'm trying : moving the "hook" above th crate, and adding a hinge joint to the crate. But has you can see it's pretty violent and unstable... My question, I guess, was just what the best way to achieve this in an efficient way is.

Hope it is clearer and thanks again Sonrisa


RE: Multiple Particle Attachment ? - josemendez - 08-10-2020

Make sure you're not forcing the rope to stay inside a collider that is also set to collide with the rope. This will cause a force feedback loop, because the rope is simultaneously trying to stay inside the collider (due to the attachment/joint) and outside of it (due to collisions), which is a situation that can't be solved and results in unstable coupling with the rigidbody. This -along with its implications and solution- is described in the manual. See the last bit of the pin constraints page (linked to from the dynamic attachments page):
http://obi.virtualmethodstudio.com/tutorials/pinconstraints.html

The correct choice in this case is to use a hinge joint (or a configurable joint) to attach the crate to the hook. Just make sure that:
1.- No collisions between the crate/hook and the end of the rope take place, as I just described.
2.- Mass ratios are reasonably small (that is, don't have a 1000 kg crate attached to a 1 gram rope, or viceversa)

cheers! Sonrisa