Help Particle Attachment on expanding rope - 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 Particle Attachment on expanding rope (/thread-4269.html) |
Particle Attachment on expanding rope - Balou - 26-06-2024 Hi, I've a rope around 1 unit long, it's attached to a rod by the first and last particle with 2 static particle attachments. On this rope there is cursor, depending on an object position (a VR controller) the cursor will either have the cursor at 0 or 1 (source always at .5) . Imagine you are pulling a rope either from the start or end. So this rope can get bigger if you pull, everything works fine here. Now when pulling I want to attach the closest particle from the controller to it. I'm getting the closest particle (avoiding the first and last) and create the attachment using this script: Code: particleAttachment = rope.gameObject.AddComponent<ObiParticleAttachment>(); And the behavior is weird, sometimes it works, sometimes points get stuck in the air like if they were attach to a world position. I feel like it's because I'm expanding the rope while dragging and sometimes the source particle can become the one attached? Do you see any edge cases with this system? Thanks a lot. RE: Particle Attachment on expanding rope - josemendez - 26-06-2024 Hi! I assume you're attaching the closest particle first, then when the user pulls the rope you detect the amount of stretch in the rope and increase its length based on this? As long as the attachment is behind the cursor and you're only increasing its length (that is, the particle is not in front of the cursors and it consumes particles until the attached particle is gone from the rope) then it should work fine. When you say "gets stuck as if attached to a world position" do you mean stuck in the air and not following the attachment at all, or following the attachment but there's an offset/gap between the particle and the point you'd expect it to be attached to? kind regards, RE: Particle Attachment on expanding rope - Balou - 26-06-2024 (26-06-2024, 09:39 AM)josemendez Wrote: Hi! Exactly I'm attaching the particle first, then I get the distance from the initial position to a new one each frame an increase the length of the rope, it works fine sometimes, so I get it has to do with the cursor position, I'll try to fix that. Quote:When you say "gets stuck as if attached to a world position" do you mean stuck in the air and not following the attachment at all, or following the attachment but there's an offset/gap between the particle and the point you'd expect it to be attached to? Yes stuck in the air and not following the attachment after some time / distance. It could be the same issue as above. Should I move the cursor dynamically when extending the rope? RE: Particle Attachment on expanding rope - Balou - 27-06-2024 From my quick tests, changing the source position fixed it. Thank you! |