Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Multiple Chains Simulation Best Practice
#1
Hi there,

Unity version: 2020.3.21f1
Obi Rope version: 6.3

I am trying to create a disc golf basket and I need to have individual chains react to a disc hitting them.  I am trying to do this with a minimal performance hit.  As is, I've created the chains as individual Obi ropes and then attached the Chain Renderer component.  Obviously the more chains I add, the more of a performance hit the game will take.  So I am trying to figure out the best approach for doing this.  This disc also isn't just a simple rigid body, so using the Obi Rigidbody component to make it collide with the chains is a bit more complicated.  I've also supplied a link to a video of me describing what I am trying to do on YouTube.  

Thank you for any assistance on this matter!


https://www.youtube.com/watch?v=Xt6Nr2N_zXc
Reply
#2
It has been over a month and no reply?  I paid for this asset and I can't get any support?
Reply
#3
(13-03-2022, 04:11 PM)sdu7chez Wrote: It has been over a month and no reply?  I paid for this asset and I can't get any support?

I'm not sure if you've noticed, but basically every query/issue on this entire forum is handled by one person, I'm sure posts get lost in the mix. Bumping the thread like we are now is the best way to follow up.

As for your performance question, really the best thing I can suggest is that you have a comprehensive read of the manual, which I'm sure you already have if you're using the chain renderer. However, there is quite a bit of information regarding the trade-off between performance and simulation quality when covering solvers and particularly the page about simulation

My *personal and relatively inexperienced advice* is to ruthlessly cut back the parts of your simulation that aren't an absolute priority(in this case the priority seems to be the pin constraints and collision detection with the disc), test the results of simpler simulations, and then build it back up to identify where performance issues are coming from and where you could find a workaround. For example, in the video you discuss the chains intercolliding, which is unlikely to be visible from a distance when the chains are already reacting to the disc collision. Given that those intercollisions will obviously be simultaneous with calculating the disc collisions, this stands out to me as a likely performance issue for little benefit if the chains don't interact at any other time. If you want the effect of all the chains reacting to an impact, there are more efficient ways such as slightly shaking the anchor rigidbody.

You should also have a look at the chain constraints page for your purposes, if you're already using it that may explain the jittering in your video, otherwise you are probably correct that the issue is that the pin constraints are causing obi particles to intersect with a collider and need to be moved, or it could be an issue with the mass ratio between the particles and the anchor rigidbody being too large. 
As for the disk collision question, simply adding an ObiCollider component to your disc and assigning the existing mesh as the source collider should achieve what you want, the rigidbody is only needed for pin constraints etc. If there are still issues, I would suggest adapting a primitive collider(scaled down capsule perhaps) and using that as the source, as obi particles are much more consistent with those than irregular meshes, particularly thin meshes like your disk.

I hope this helps, and I'm sure José will swoop in with some more specific and useful advice soon  Gran sonrisa
Reply
#4
(13-03-2022, 04:11 PM)sdu7chez Wrote: It has been over a month and no reply?  I paid for this asset and I can't get any support?

Hi there,

Your thread slipped trough, very sorry about that. My mistake entirely, please accept my apologies. Usually I answer within 24-48 hours, if you ever post in the forum and don't receive an answer within 3-4 days that means I simply didn't see it, just bump it or write to our support email so that it grabs my attention.

About the questions in your video:

#1) Regarding the FPS drop: make sure you're using the Burst backend as it's slightly faster than the one used as a fallback. Then, take a look at Unity's profiler to see what is taking most time each frame. It might be simulation, rendering, etc. There's tons of parameters in Obi that can potentially have a large impact on performance, so profiling info is most valuable in situations like this.

For instance, the profiler might show most of the time is spent on constraints, which means using less constraint iterations will improve performance. Or, it might reveal that placing the chain prefabs for rendering is the bottleneck, which might be resolved using instancing. If you need help interpreting the profiler info, you can just share a pic and I will do my best to help.

#2) Chains are certainly too close to each other (and/or a nearby collider?), so attachments and collision constraints are fighting each other. This situation is described in the manual, along with its solution (which involves using collision filtering to prevent collisions between specific parts of the rope/chain):
http://obi.virtualmethodstudio.com/manua...aints.html

Collision filtering is explained in the "collisions" page:
http://obi.virtualmethodstudio.com/manua...sions.html

To understand why this happens: collision constraints want chains to keep out of each other, however attachments want them to stay attached - which might require them to intersect. Since it's impossible for ropes to intersect and not intersect simultaneously, this results in jitter as the engine tries to solve an unsolvable situation.

#3) I'm not sure I understood the issue with disc collisions. The disc as shown in the video is a fairly simple object, it only has one collider and one rigidbody in its hierarchy. Placing a ObiCollider component right where the MeshCollider is should do the trick. Obi automatically finds the first rigidbody up the collider's hierarchy and picks it up, so no further setup is needed.

Keep in mind though that MeshColliders are both quite costly and extremely brittle (specially, non-kinematic mesh colliders). This is because they have no volume, only their surface generates contacts. This can lead to tunneling issues, specially if the collider is fast moving.

Obi has a custom collision primitive that allows for fast moving arbitrary shapes and robust collision detection, at a fraction of the runtime cost of a MeshCollider: distance fields.

On a side note, keep an eye on your chain resolution and particle radius: there might be gaps in its particle-based representation that the disc might slip trough (you can visually inspect the particles in each chain by adding a ObiParticleRenderer  component to them). You might want to use surface collisions instead.

Let me know if I can be of further help.
Reply
#5
Thank you both for your assistance on this matter.  I appreciate the time and direction!
Reply