Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  when increasing chain length gets stuck
#1
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; }

        }

    }
Reply
#2
How's your cursor setup? Specifically, what are the cursor/source mu values?
Reply
#3
(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
Reply
#4
(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.
Reply
#5
(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
Reply