Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Weird Solver Behaviour
#1
Hi,
I was developping a game partially filled with Ropes, and I encountered a weird problem along the way.

My ropes are Instatiated in run-time, with a simple script that generates a blueprint with two control points (and two constraints) that the user chooses. Everything works fine.
The ropes are on Collision Category 0, and collide with everything but 0.

However, destroying a simple gameobject with an Obicollider (and an OBiRigidbody) on it, makes one Rope (only one) have one of its constraints moved to the destroyed Gameobject.
The ropes teleports one of its ends to the destroyed Gameobject.
The colliders are on Collision category 1 and collide with everything.

The Ropes and the colliders have no relation between them, So my guess is that it is coming from the Solver.

But how to fix it? I have no idea.

Could you please help?

EDIT : A DestroyImmediate on the ObiRigidbody works fine. I guess that the solver methods called in this very frame makes the whole thing bug. Is There any way to avoid this? I'dlike not to use DestroyImmediate!
Reply
#2
To Add more details about what happens, here's some screenshots.
The minispider is Destroyed when it falls in the basket.
When it happens, the problem happens on my main spider's arm. They have nothing related,excpet their solver.

When N mini-spider are detroyed, the same problem occurs N times (my main spider looses the other side of its first rope, then it looses its first side of its second arm, etc).

Weird.


Attached Files Thumbnail(s)
       
Reply
#3
(15-12-2021, 02:44 PM)Reydans Wrote: When N mini-spider are detroyed, the same problem occurs N times (my main spider looses the other side of its first rope, then it looses its first side of its second arm, etc).

Weird.

Hi there,

I'm unable to reproduce this, destroying GameObjects in the scene should not change the existing attachments to other objects as they're unrelated. Can you sen your project (or any scene that exhibits this) to support(at)virtualmethodstudio.com? This way I can take a closer look and determine what the cause might be. thanks!
Reply
#4
(15-12-2021, 03:00 PM)josemendez Wrote: Hi there,

I'm unable to reproduce this, destroying GameObjects in the scene should not change the existing attachments to other objects as they're unrelated. Can you sen your project (or any scene that exhibits this) to support(at)virtualmethodstudio.com? This way I can take a closer look and determine what the cause might be. thanks!

I just sent you a scene extracted from the game that reproduces the bug at the support mail address.

Silly me, I forgot to tell you that the game is made for mobile devices, So the controls are only with the mouse on the editor.
Drag and drop from the spider Body to create one rope, that you can stick to the walls.
Drag from elsewhere across the ropes to cut them.

Tell me if something went wrong!q
Reply
#5
(16-12-2021, 10:05 AM)Reydans Wrote: I just sent you a scene extracted from the game that reproduces the bug at the support mail address.

Silly me, I forgot to tell you that the game is made for mobile devices, So the controls are only with the mouse on the editor.
Drag and drop from the spider Body to create one rope, that you can stick to the walls.
Drag from elsewhere across the ropes to cut them.

Tell me if something went wrong!q

Received, thanks! will take a look at it later today, tomorrow at worst. Will get back to you with any findings.
Reply
#6
Hi there!

Answered to your email, and sent you a fixed version of your script. The issue is that you were not flagging the constraints dirty when adding or removing colliders. I'm pasting my answer here for reference too:

In the Rope.cs file, you're creating a rope and placing a couple pin constraints manually at its ends. You're passing the "from" and "to" colliders to it. When a pin constraint is created, the current indices of the colliders you pass to it are stored in the solver, since the solver deals with particle and collider indices. If colliders are later created or destroyed, these indices might change so you need to flag the constraints as dirty.

When using attachments this is handled automatically, but if you're managing pin constraints manually you must take care of flagging them dirty when necessary, so they're rebuilt. Check the manual's "Scripting constraints" page, specifically "Adding/Removing constraints":

http://obi.virtualmethodstudio.com/manua...aints.html

Quote:After you've added or removed particles/colliders, you will need to call actor.SetConstraintsDirty(). This rebuilds all solver batches of the given constraint type.

I've modified your Rope script to account for this.
Reply
#7
Hi, 

Thanks for your help, it all makes sense to me now

Works like a charm as always!
Reply