Obi Official Forum
Help (Solved) Ropes allowing objects to pass through them - 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 (Solved) Ropes allowing objects to pass through them (/thread-2137.html)



(Solved) Ropes allowing objects to pass through them - SpiralCircus - 02-04-2020

Just bought the asset as an alternative to janky rigidbody/hinge based unity ropes. I really like it so far, but I'm struggling with an unexpected behaviour.

My game requires that ropes prevent unity physics objects from passing through them. Ropes are used to block npcs and players from passing through to certain areas, and they are also used to hold physics objects in place before the user cuts them down.

The attached gif shows two identical ropes / solvers. The one of the right has kinematic rigidbodies below it to show that collision between ropes and unity physics objects is working as expected. On the left you see dynamic rigidbodies falling down onto a rope fixed at both ends. My problem is that in this case the objects are able to easily pass through the rope. Smaller objects are completely unaffected by it. The larger the falling object the more significant the interaction with the rope, but none of them behave as I would expect.

Is there any advice you could give to help me improve the rope's ability to "carry" or "hold" other objects, and prevent them from passing through?

[Image: 95HL3cg.gif]

SOLVER:
[Image: TzeffDf.png]

ROPE:
[Image: C394Fsb.png]


RE: Can ropes "hold" other objects? - josemendez - 02-04-2020

Yes they can. However, if your rope resolution is not high enough (meaning there's gaps in between particles trough which small objects can pass), or if the mass ratio between the objects and the particles is high enough so that gaps open as a result of heavy rigidbodies pushing past very light particles, objects might pass trough ropes.

There's many ways to prevent this, these are some of the easiest:
- Increase rope resolution.
- Increase the amount of distance constraint substeps.
- Increase the amount of updater substeps.
- Reduce the mass ratio (either increase particle mass, or decrease rigidbody mass)

Also, adding a ObiParticleRenderer to your ropes will make it easy to debug what's actually happening with the particles. See:
http://obi.virtualmethodstudio.com/tutorials/particlerendering.html

kind regards,


RE: Can ropes "hold" other objects? - SpiralCircus - 02-04-2020

(02-04-2020, 03:57 PM)josemendez Wrote: There's many ways to prevent this, these are some of the easiest:
- Increase rope resolution.
- Increase the amount of distance constraint substeps.
- Increase the amount of updater substeps.
- Reduce the mass ratio (either increase particle mass, or decrease rigidbody mass)

...ObiParticleRenderer...

Thanks for your quick response. I have tried all the things you've suggested. Here is every relevant detail of my setup. Anything I haven't specifically mentioned remains at it's default value. I've used red to indicate the fields I've altered specifically to test your suggestions. I see that the particles are nice and close together but the smaller balls still fall straight through the rope.

Rope Blueprint:
- Thickness: 0.1
- Resolution: 1
- Pooled Particles 1000
- Path:
    - Point A (left). Mass = 0.1
    - Point B (right). Mass = 0.1

Solver:
- Mode: 2D
- Damping: 0.75
- Distance Constraint (Sequential, 8 iterations)
- Collision Constraint (Sequential, 8 iterations)

Updater:
- Substep: true
- Substeps: 8

Falling objects:
- Circle Collider 2D
- Rigidbody 2D (dynamic, mass = 0.1, Drag = 1, Collisions = Discrete)
- Obi Collider 2D (all default settings)
- Obi Rigidbody 2D (kinematic for particles = false)

Rendering:
Obi Rope Line Renderer (purple)
Obi Particle Renderer (black)

Attachments:
Obi Particle Atttachment (Point A, Static)
Obi Particle Attachment (Point B, Static)

NOTE:
The rope is 10 unity units long from end to end.

Starting from this setup I've tried the following changes:
- Changing mass ratio from 1:1 to 10:1 to 1:10 - No change in behaviour
- Turning off physics substeps entirely - No change in behaviour
- Reducing distance and collision iteration counts back to their default values - No change in behaviour
- Reducing rope blueprint resolution to 0.5 - Behaviour is markedly worse, even the largest objects pass through easily

[Image: r4JlOTy.gif]
Thanks again for your help, any other suggestions would be welcome.

[EDIT: Also, if you notice, the rope seems to want to push the objects in contact with it quite hard to the left. This doesn't seem to respect the angle of incidence of the ball, it's always left no matter the objects position or direction when colliding . That seems odd to me too.]


RE: Can ropes "hold" other objects? - josemendez - 02-04-2020

Now that you mention particles always being pushed left: is your solver far from the scene origin?

It could be a floating point precision issue (though that's a long shot). Just in case, try placing your solver object in the scene origin, see if that improves anything.


RE: Can ropes "hold" other objects? - SpiralCircus - 03-04-2020

(02-04-2020, 06:18 PM)josemendez Wrote: Now that you mention particles always being pushed left: is your solver far from the scene origin?

It could be a floating point precision issue (though that's a long shot). Just in case, try placing your solver object in the scene origin, see if that improves anything

Solved. Good catch Jose, thank you.

The solver was somewhere near (256, -256, 0). When i zeroed it out, the rope becomes compeltely inpenetrable. To double check that i could still place distant ropes I left the solver at the origin but moved the path points back to their original position and it still works.

Thanks for taking the time to help me through this, much appreciated.

[Image: smP1QzU.gif]


RE: Can ropes "hold" other objects? - josemendez - 03-04-2020

Glad you got it working!

Note that in an upcoming update, we have improved precision considerably by expressing colliders in solver space too. In 5.3, you will be able to either leave the solver close to the origin, or moving it far away from it.


RE: Can ropes "hold" other objects? - SpiralCircus - 03-04-2020

(03-04-2020, 11:05 AM)josemendez Wrote: Glad you got it working!

Note that in an upcoming update, we have improved precision considerably by expressing colliders in solver space too. In 5.3, you will be able to either leave the solver close to the origin, or moving it far away from it.

Great, really impressed with this asset, it is filling a glaring hole in the unity ecosystem. Your support has been super helpful too. Will drop a proper review in the asset store after I've had some more time to integrate it into my game.

All the best.