Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Particle Attachment on expanding rope
#1
Pregunta 
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>();
                particleAttachment.enabled = false;
                particleAttachment.target = m_Controller;

                var group = ScriptableObject.CreateInstance<ObiParticleGroup>();
                group.particleIndices.Add(attachedParticleIndex);
                group.name = "Test";


                particleAttachment.particleGroup = group;
                particleAttachment.attachmentType = ObiParticleAttachment.AttachmentType.Static;
                particleAttachment.enabled = true;

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.
Reply


Messages In This Thread
Particle Attachment on expanding rope - by Balou - 26-06-2024, 01:43 AM