Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Possible Bug in ObiRopeCursor Class Leading to Infinite Rope Length
#1
Hi. I've recently upgraded to Obi 7 and believe I've encountered a bug in the "ObiRopeCursor" class. Specifically, I'm able to increase the length of a rope indefinitely.

The issue arises when the maximum number of particles is reached. As the rope's length continues to increase, additional length is added to "m_CursorElement.restLength", but there appears to be no limit in place. This causes a section of the rope to appear as a straight line, which doesn't seem intended.

To confirm, I replicated this issue in the Crane example scene within a fresh Unity project with Obi 7 installed.

I found a potential solution by modifying the code on line 208 in the Rope_OnSimulate method:

Original Code (Line 208):
Code:
// Line 208
if (lengthChange > 0)
m_CursorElement.restLength += lengthChange;

Proposed Solution:

Code:
if (lengthChange > 0 && m_CursorElement.restLength < rope.ropeBlueprint.interParticleDistance)
{
      m_CursorElement.restLength = Mathf.Min(m_CursorElement.restLength + lengthChange, rope.ropeBlueprint.interParticleDistance)
}

This change ensures that the 'restLength' does not exceed the 'interParticleDistance', preventing the unintended straight-line section of the rope.
Reply
#2
Hi!

This change is intentional, requested by several users. Once the rope runs out of pooled particles, it is not possible to keep resolution constant anymore but is conceptually possible to continue making the rope longer. So even though there's no more particles available, the total length of the rope is increased by making the element where the cursor is placed longer.

If you need the old behavior, a simple way to obtain it is to clamp the change in length passed to ChangeLength() so that the resulting rest length doesn't exceed a desired maximum length.

Let me know if you need further help,

kind regards
Reply
#3
ah that makes sense. Thanks for the quick reply.

I have been having a few issues with upgrading from Obi 6. I'll probably make another post about it in a few days once I'm able to better explain the issues.

Thanks
Reply