Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  When adding rope, the new rope section gets "stuck" and behaves strangely
#1
So there's an action in my prototype that will cause a rope to lengthen so that it's usable. When this is done, I'm seeing two problems:

1) The rope gets a bit longer, but not as long as defined... until you jump on it, at which point it sort of gets "unstuck".

2) The rope doesn't seem to be simulated correctly until it gets "unstuck". This doesn't actually hurt my use case, but I thought it might be a hint about what's going on.

Here's the code I'm using for testing:
Code:
void Update()
    {
        if (Input.GetKeyDown(KeyCode.F12) )
        {
            resizeRope = true;
            MainCanvasScript.instance.ShowQuickInfoMessage("Start Rope Resize", 1f);
           
            //cursor.sourceMu = 1f;  // default 0
            cursor.cursorMu = 1f;  // default 0;  start adding rope at the end
            cursor.direction = false;  // default true;  don't understand why, but no visible rope spools out if this is true
        }
    }

    void FixedUpdate()
    {
        if (resizeRope && obiRope.restLength < resizedLength)
        {
            cursor.ChangeLength(obiRope.restLength + lengthAddedPerStep);
            Debug.Log(obiRope.restLength);
        }

        if (resizeRope && obiRope.restLength >= resizedLength)
        {
            resizeRope = false;
            MainCanvasScript.instance.ShowQuickInfoMessage("resize complete", 3f);
        }
    }

Here's a video showing the behavior that I'm talking about. You can see how the rope is using physics before it's resized, but stops reacting after the new section is added... until I jump on it and start swinging.
https://www.youtube.com/watch?v=tp34KpfQ1Ak


I can also post my janky WIP code for how the player attaches/climbs if it's useful, but I'm leaving it out for now because it's a bit long. Basically it's just moving the character to the next particle index and creating a particle group / attachment at that particle.
Reply


Messages In This Thread
When adding rope, the new rope section gets "stuck" and behaves strangely - by ShawnF - 22-08-2023, 01:57 PM