Obi Official Forum
Help when increasing chain length gets stuck - 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 when increasing chain length gets stuck (/thread-2881.html)



when increasing chain length gets stuck - JskT01 - 21-04-2021

When I increase the length of my chain in the awake function in the final construction sometimes it gets stuck and if I move it it is as if it was fixed at that point where it got stuck, this does not happen in the editor,it only happens occasionally when I open the project
Is it because from awake it starts to increase the length?
Code:
void Awake()
    {
        instance = this;
        chainShort = true;
        rope = GetComponent<ObiRope>();
        //Debug.Log("rest" + rope.restLength);
    }

    // Update is called once per frame
    void Update()
    {
        if (chainShort == true)
        {
            IncreaseLenght(1);
        }
        if (chainLarge == true)
        {
            IncreaseLenght(-1);
        }
    }
    internal void IncreaseLenght(float normX)
    {
        //Debug.Log("increse lenght");
        //Debug.Log(rope.restLength);
        if (normX == 1)
        {
            if (rope.restLength > min)
            {
                for (int i = 0; i < cursor.Length; ++i)
                {
                    cursor[i].ChangeLength(rope.restLength - speed * Time.deltaTime);


                }

            }
            else { chainShort = false; /*Debug.Log("rest" + rope.restLength);*/ }

        }
        if (normX == -1)
        {
            if (rope.restLength < max)
            {
                for (int i = 0; i < cursor.Length; ++i)
                {
                    cursor[i].ChangeLength(rope.restLength + speed * Time.deltaTime);

                }
            }
            else { chainLarge = false; }

        }

    }



RE: when increasing chain length gets stuck - josemendez - 22-04-2021

How's your cursor setup? Specifically, what are the cursor/source mu values?


RE: when increasing chain length gets stuck - JskT01 - 22-04-2021

(22-04-2021, 07:42 AM)josemendez Wrote: How's your cursor setup? Specifically, what are the cursor/source mu values?
Cursor MU 0
Source MU 0


RE: when increasing chain length gets stuck - josemendez - 22-04-2021

(22-04-2021, 06:07 PM)JskT01 Wrote: Cursor MU 0
Source MU 0

Is the first particle attached? If so, you'll be creating more fixed particles when extending the rope, since source mu == 0 == first particle in the rope.


RE: when increasing chain length gets stuck - JskT01 - 29-04-2021

(22-04-2021, 07:35 PM)josemendez Wrote: Is the first particle attached? If so, you'll be creating more fixed particles when extending the rope, since source mu == 0 == first particle in the rope.

I removed the script that makes the chain longer or shorter and I discovered that that is not what is causing the rope to not work correctly, when reloading the scene it is when the chain does not work, I do not know what happens, I added a line to my code in awake hoping it would work but it didn't work.

  cursor.GetComponent <ObiRope> () .ResetParticles ();

I have 3 solvers in the scene and one fixed update