22-06-2022, 08:32 AM
(This post was last modified: 22-06-2022, 08:42 AM by josemendez.)
Hi Natty,
Springyness can be reduced by using more substeps, it cannot be completely eliminated though as it would require to use infinite substeps. This is not a quirk specific to Obi, it's just how physics engines work: time is chopped up into small "steps", during each step all quantities are linearized which means objects cannot change direction or moving speed within the step. If a rope is moving fast enough, and/or has enough mass (both affect inertia) it will spring back slightly once it reaches its max length.
This is also why if you create a tall enough stack of boxes in any engine, they will slightly penetrate each other. The longer the timestep, and the taller the stack, the more "springy" collision response will be.
Still, even moderate settings in Obi should yield useable results in this regard. I'm only using 10 substeps for a thin 10 meter long rope, it's quite snappy and really stable:
Dynamic attachments are constraints, which mean they work by applying forces on both the bobber and the rope (as opposed to static attachments, which just set the rope's position kinda like a parent-child relationship). Since time is discrete (see my first paragraph) this can mean the bobber can only move in a straight line within each physics timestep. This may or may not be enough to match its position with the rope during violent motion. You can see this in the video above too, when I flick the rope around randomly.
A simple solution to get rid of the visual gap would be to just move the end particle to the attachment position every frame. You'd be trading the gap for a slightly crooked look at the end of the rope. This is akin to what the "projection mode" in rigidbody joints do: snap the position of the rigidbodies even if it's physically incorrect, to try and hide gaps. Should be a simple thing to write, in fact I believe I have some sample code around that does this. Let me look for it and get back to you.
Not sure what you mean by "spinning out of control", that sounds weird. Position-based dynamics (the framework used by Obi) is generally very stable and well-behaved even under extreme conditions. Could you share a video of this behavior?
Did some tests with center of mass (above video) but results look ok to me. Never had any issues reported regarding center of mass tbh. The rope mass I used is 0.01 kg per particle and the bobber is 0.1 kg, so a mass ratio of 1:10 which is about the recommended maximum for an iterative engine.
How have you changed the center of mass? Have you set a new position programmatically? (ie rigidbody.centerOfMass = whatever) or just placed a larger collider at the bottom?
In the video above I just placed a sphere at the bottom of the rigidbody to lower the CoM and relied on Unity to automatically calculate it.
Imho I guess the best course of action at this point is for me to take a look at the project itself, otherwise it's a lot of back and forth guesswork. Would this be possible?
kind regards,
(22-06-2022, 03:11 AM)Natty Wrote: The rope itself is still way too "springy" and overall just out of control.
Springyness can be reduced by using more substeps, it cannot be completely eliminated though as it would require to use infinite substeps. This is not a quirk specific to Obi, it's just how physics engines work: time is chopped up into small "steps", during each step all quantities are linearized which means objects cannot change direction or moving speed within the step. If a rope is moving fast enough, and/or has enough mass (both affect inertia) it will spring back slightly once it reaches its max length.
This is also why if you create a tall enough stack of boxes in any engine, they will slightly penetrate each other. The longer the timestep, and the taller the stack, the more "springy" collision response will be.
Still, even moderate settings in Obi should yield useable results in this regard. I'm only using 10 substeps for a thin 10 meter long rope, it's quite snappy and really stable:
(22-06-2022, 03:11 AM)Natty Wrote: I also noticed at times that the rope "disconnects" from the bobber where it is attached, like there's a small gap of space there sometimes.
Dynamic attachments are constraints, which mean they work by applying forces on both the bobber and the rope (as opposed to static attachments, which just set the rope's position kinda like a parent-child relationship). Since time is discrete (see my first paragraph) this can mean the bobber can only move in a straight line within each physics timestep. This may or may not be enough to match its position with the rope during violent motion. You can see this in the video above too, when I flick the rope around randomly.
A simple solution to get rid of the visual gap would be to just move the end particle to the attachment position every frame. You'd be trading the gap for a slightly crooked look at the end of the rope. This is akin to what the "projection mode" in rigidbody joints do: snap the position of the rigidbodies even if it's physically incorrect, to try and hide gaps. Should be a simple thing to write, in fact I believe I have some sample code around that does this. Let me look for it and get back to you.
(22-06-2022, 03:11 AM)Natty Wrote: My idea was to use Obi Rope, play an animation to wind up / pull back the fishing pole, then on the animation for casting forwards, apply a forward force to the bobber and increase Obi Rope length at the same time. Although I am getting this halfway working, the rest of it all is just a mess in terms of the rope spinning out of control and overall just how bouncy/springy it is. I am happy to post up settings and details again if needed.
Not sure what you mean by "spinning out of control", that sounds weird. Position-based dynamics (the framework used by Obi) is generally very stable and well-behaved even under extreme conditions. Could you share a video of this behavior?
(22-06-2022, 03:11 AM)Natty Wrote: Edit: In addition to the above, I can't get a semi-realistic hanging bobber. For some reason the bobber when hanging from the rope, dangles in strange ways. It almost looks like the mass is not being applied to the bottom part of the bobber. So I set the rigidbody's center of mass to the bottom part of the bobber, but that still didn't make a difference. Sometimes when running around the bobber flips upside down and almost looks like it's floating a bit. Yet gravity and mass is applied. I just want it to swing/hang properly as you would expect with a heavier object hanging from a rope.
Did some tests with center of mass (above video) but results look ok to me. Never had any issues reported regarding center of mass tbh. The rope mass I used is 0.01 kg per particle and the bobber is 0.1 kg, so a mass ratio of 1:10 which is about the recommended maximum for an iterative engine.
(22-06-2022, 03:11 AM)Natty Wrote: It's like the red upper part of the bobber where the rope connects is what's controlling how the bobber moves, and the center of mass at the white bottom part of the bobber is just not being counted.
How have you changed the center of mass? Have you set a new position programmatically? (ie rigidbody.centerOfMass = whatever) or just placed a larger collider at the bottom?
In the video above I just placed a sphere at the bottom of the rigidbody to lower the CoM and relied on Unity to automatically calculate it.
Imho I guess the best course of action at this point is for me to take a look at the project itself, otherwise it's a lot of back and forth guesswork. Would this be possible?
kind regards,