Obi Official Forum
Help Debugging the difference between editor and build behavior - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help Debugging the difference between editor and build behavior (/thread-2460.html)



Debugging the difference between editor and build behavior - protomenace - 02-09-2020

I have a setup with a rope dynamically connected at either end to two rigidbodies. I've managed to tune the masses of the rope and the bodies to my liking, and when I enter play mode in the editor everything works as expected. The rope and its connected bodies are stable at rest on the ground, and I can pick up either body and move everything around, and it behaves nicely.

However, when I create a build (Windows, x86_64, IL2CPP, Unity 2019.4.8f) and run the same scene, the rope absolutely freaks out. My dynamic bodies go flying through the world at thousands of meters per second as the rope spasms wildly.

What kind of things should I be looking at to try to debug this difference in behavior between the editor and a build? Could it be framerate dependent somehow? Are there some build settings I should be cognizant of that Obi is particularly sensitive to?


RE: Debugging the difference between editor and build behavior - josemendez - 02-09-2020

(02-09-2020, 07:14 PM)protomenace Wrote: I have a setup with a rope dynamically connected at either end to two rigidbodies. I've managed to tune the masses of the rope and the bodies to my liking, and when I enter play mode in the editor everything works as expected. The rope and its connected bodies are stable at rest on the ground, and I can pick up either body and move everything around, and it behaves nicely.

However, when I create a build (Windows, x86_64, IL2CPP, Unity 2019.4.8f) and run the same scene, the rope absolutely freaks out. My dynamic bodies go flying through the world at thousands of meters per second as the rope spasms wildly.

What kind of things should I be looking at to try to debug this difference in behavior between the editor and a build? Could it be framerate dependent somehow? Are there some build settings I should be cognizant of that Obi is particularly sensitive to?

Off the top of my head: make sure your rope is not attached inside the two rigidbodies, if it's set to collide with them. This is a very common mistake that  results in largely undefined behavior: might work fine, might jitter/explode. Usually it's the latter.

The reason for this is that attaching particles inside a body they must collide with is an impossible to solve situation: should the particle follow the attachment and stay inside the collider, or should it ignore the attachment and get out of the collider? both conditions can't be met at once, so this creates a force feedback loop: forces are applied to both the rope and the rigidbody so that they stop colliding, but the attachment brings the rope back in, so even more force is applied to both...you get the idea.

The manual describes this situation along with its solution: use phases to make sure the particles attached inside the rigidbody do not collide with it. See the last bit of:
http://obi.virtualmethodstudio.com/tutorials/pinconstraints.html


RE: Debugging the difference between editor and build behavior - protomenace - 02-09-2020

(02-09-2020, 07:35 PM)josemendez Wrote: Off the top of my head: make sure your rope is not attached inside the two rigidbodies, if it's set to collide with them. This is a very common mistake that  results in largely undefined behavior: might work fine, might jitter/explode. Usually it's the latter.

The reason for this is that attaching particles inside a body they must collide with is an impossible to solve situation: should the particle follow the attachment and stay inside the collider, or should it ignore the attachment and get out of the collider? both conditions can't be met at once, so this creates a force feedback loop: forces are applied to both the rope and the rigidbody so that they stop colliding, but the attachment brings the rope back in, so even more force is applied to both...you get the idea.

The manual describes this situation along with its solution: use phases to make sure the particles attached inside the rigidbody do not collide with it. See the last bit of:
http://obi.virtualmethodstudio.com/tutorials/pinconstraints.html

So I have actually prepared for this I believe. My setup is like this. I have 1 control point that's inside the attached object in phase 0:
https://ibb.co/nQ9XN7n

And the next control point outside the object in phase 1:
https://ibb.co/LnDrjtY

The Obi collider is in phase 0:
https://ibb.co/Bg7gs4j

The opposite end of the rope is connected to another object in a symmetrical fashion.

Does that seem like it's set up properly with regard to preventing collision issues?


RE: Debugging the difference between editor and build behavior - josemendez - 03-09-2020

(02-09-2020, 11:04 PM)protomenace Wrote: So I have actually prepared for this I believe. My setup is like this. I have 1 control point that's inside the attached object in phase 0:
https://ibb.co/nQ9XN7n

And the next control point outside the object in phase 1:
https://ibb.co/LnDrjtY

The Obi collider is in phase 0:
https://ibb.co/Bg7gs4j

The opposite end of the rope is connected to another object in a symmetrical fashion.

Does that seem like it's set up properly with regard to preventing collision issues?

This looks ok to me. Just to make sure this is not the issue, try taking out the attached control point from the collider, up to a safe distance. If the rope resolution is high enough, particles can be very tightly packed so the second or third particle in the rope might still be inside the collider.

If this still does not work, we can bring out the big debugging guns. Sonrisa