23-01-2023, 10:31 AM
(This post was last modified: 23-01-2023, 10:38 AM by josemendez.)
(22-01-2023, 07:11 PM)hariedo Wrote: I am interested in doing something along the lines of your existing Freight Lift demo, where there's a number of ropes holding a mass like a pendulum.
In my situation though, the cables are much longer. I have the bounciness under control but now would like to reduce or damp the amount of pendulum swing when the top of the freight crane moves. Real physics is cool, and all, but this is a game and I don't want to make users cry with trying to stabilize the load quite that much.
What is the best way to do this? I am thinking of measuring the deflection and applying a counter force to the load/platform objects pinned at the bottom of the ropes. Is there a specific Obi API or should I just apply it with regular Physics.AddForce()? Or is there an alternative?
Hi there!
You specifically mention the pendulum/load instead of the rope, rigidbodies in Unity have a specific setting for this: drag. This erodes linear velocity away to make the object come to a rest position faster. There's also an angular/rotational version of it, that will cause objects to stop rotating faster. Check the manual for details: https://docs.unity3d.com/Manual/class-Rigidbody.html
If you want to damp rope movement too (or instead), Obi has a similar setting called damping, that you can find in the ObiSolver component.
(22-01-2023, 07:11 PM)hariedo Wrote: (As an aside, with the Freight Lift demo, I noticed that if I change the rope density below about 0.25 to help reduce the distance constraint workload, the simulation refuses to lengthen/shorten the ropes. I didn't see anything in the docs about a valid range here.)
Less resolution -> less constraints -> faster convergence -> everything becomes more rigid. This is a basic consequence of how all iterative physics engines works, and position-based ones in particular. The manual contains an in-depth explanation of how iterations/substeps/constraints work: http://obi.virtualmethodstudio.com/manua...gence.html
Also, less resolution results in less particles and hence less bending points for the rope, so from a purely geometrical perspective the rope will have a much harder time crumpling / compressing. At minimum resolution, a rope is made of only 2 particles and a single distance constraint, so the rope is completely unable to bend since it's just a straight line passing trough 2 points in space.
So there isn't a "valid" resolution range, it all depends on what you want to do. Think of the rope as a chain: the more links it has and the smaller they are, the more detailed its movement. As links become larger and there's less of them, the chain's freedom of movement becomes limited. At the extreme setting of only 1 link, it won't be able to bend at all and unless the links themselves are elastic, it won't be able to compress or stretch either.
If you want to explicitly make distance constraints compressible, they have a "Max compression" setting that can be used to specify the percentage of compression allowed: http://obi.virtualmethodstudio.com/manua...aints.html
And if you want to make them elastic, increase stretch compliance.
kind regards