Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Obi Rope Constraints not simulated Bug
#1
Hello All,

I'm having a very weird issue with Obi Rope lately, and it looks like it's a bug from the plugin. I'm using Obi 6.2.

I'm developing a game where the Player can attach itself to objects and drag them around, using a Rope.
I've been configuring the different Constraints in the Obi Solver, tweaking the amount of iterations in order to get what I want.
Right now, Distance Constraints and Collision Constraints are set up with a high amount of iterations, which gives my rope a quite realistic result, as it will do its absolute best to keep its length and wrap around any surface it encounters without going through them, and apply a lot of tension on the linked objects, which is great.
I also have pin constraints set up through script that link the player with the targeted object.
The mass of the player is 100. While the mass of the objects range from 10 to 10000. With very heavy objects, the player is completely constrained by the attached rope.
The rope itself has a mass of 1, but it works pretty much the same through the range 0.5 to 5. A heavier rope will instantly break the rope.
The rope has Bend Constraints set up entirely at 0.
The rope has Distance Constraints with stretching at 1, the rest at 0.
The rope has Tearing with tear resistance at 100000, and tear rate at 1. Which allows tearing only when an extreme force is applied.

But, in several situations, the distance constraints seemed to be completely absent, as if there were not setup.
After some tests though, it seems like the player is just not affected by the two-way interaction with the Rope, as the rope does not keep its length at all, and eventually breaks, and the player just doesn't seem affected by the tension. Even though pin constraints are setup correctly, and it's been working fine in every situation.
But in the following situations, it does not :
- In build. All builds of the game lately have had this bug, while in editor it worked fine.
- Having the Solver in a Prefab. For some reason this triggered the bug too.
- Copying the Solver a second time (having more than one solver in the scene, even when only one is active)
- When updating the plugin to Obi 6.3, which I just did today.

I have no idea what is causing this, and why the simulation is different in these situations, but I'll be glad if this post could get reviewed by the Obi team.
If you need more details, I'll gladly link some more videos or screens.

Thank you for your time,

Max.
Reply
#2
Hi!

Never heard of behavior similar to what you describe.

(07-02-2022, 02:56 PM)Moujingue Wrote: - In build. All builds of the game lately have had this bug, while in editor it worked fine.

The physics engine code is the exact same both in-editor and in the build, regardless of the backend you use.

(07-02-2022, 02:56 PM)Moujingue Wrote: Having the Solver in a Prefab. For some reason this triggered the bug too.

Solvers don't really care if they're part of a prefab or not, so this is quite strange too.

(07-02-2022, 02:56 PM)Moujingue Wrote: I'm using Obi 6.2.[...]
it's been working fine in every situation.
But in the following situations, it does not :
-When updating the plugin to Obi 6.3, which I just did today.

Not sure if you mean that it works in 6.2 but not in 6.3, or vice-versa. Also, the current version available in the store is 6.4, not 6.3.

Quote:I have no idea what is causing this, and why the simulation is different in these situations, but I'll be glad if this post could get reviewed by the Obi team.

Sure, but it's highly unlikely I will be able to reproduce this on my own if you don't provide a repro project. Could you please send a minimal reproducible example to support(at)virtualmethodstudio.com? thanks!
Reply
#3
Hello Jose,

Thanks a lot for the answer.
I was quite confused with this behaviour obviously, I figured it would be almost impossible to reproduce, but I wondered if this was potentially an issue that already came up.
So sure, I'll provide a repro project asap, so that you can see this for yourself.
In what format do you want the project ? Is a git repository alright ?

And yes, I was using Obi 6.2, and it worked fine in editor (with the occasional situations I described). And I just upgraded to version 6.4 (and not 6.3), and this unexpected behaviour is the only one I have now.

Max.
Reply
#4
Hi Max,

git repo is fine, .zip file is file, anything goes.

kind regards,
Reply
#5
In case anyone reads this later on: this issue was caused by the project's character controller overwriting the character's velocity in its FixedUpdate():

Code:
character.rigidbody.velocity = inputVelocity;

Since the order in which Unity calls FixedUpdate() for different objects is by default undefined, in cases where Obi was updated first and the character controller last this would happen (pseudocode):

Code:
// Obi applies rope force to the character:
character.rigidbody.velocity += rope.force / character.mass;

// Character controller overwrites velocity, any changes made by other scripts prior to it are lost:
character.rigidbody.velocity = inputVelocity;

As a result any changes made by Obi -or potentially any other script- to character velocity would be overwritten by the character controller. Since update order is undefined this was difficult to reproduce in the project as it would sometimes work somewhat correctly (Obi would modify the velocity after the character controlling writing it) sometimes not.

The fix is to modify the character controller so that it doesn't ignore the character's current velocity.
Reply