Help Obi rope in combination with joints stretches the rope infinitely - 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 Obi rope in combination with joints stretches the rope infinitely (/thread-3305.html) |
Obi rope in combination with joints stretches the rope infinitely - jsladovic - 05-02-2022 Hi, Apologies if this is something people have previously asked for, I have only recently gotten into working with Obi and am yet to grasp all of it's features. I tried googling for a result and searching the forums here, but to no success. I have a rope connected to a fixed object on one side and a moveable object (let's call it a ball for the sake of simplicity) on the other. When I manually move the ball through the scene view, the rope doesn't stretch. But when my player picks up the object, I create a fixed joint component on the ball which is connected to the player Rigidbody. Then I move the player around and the ball moves alongside him and the rope stretches. When I stop moving the player, the rope slowly starts dragging the ball (and the player) back into position. Is there a way to prevent the rope from stretching in the first place? For what it's worth, my Distance iterations have been set to 20, my Substeps in the Fixed Updater have been set to 4. The Obi Rigidbody component doesn't have the Kinematic For Particles field set and the ball Rigidbody is not set as Kinematic. I'd gladly post whatever else you need. RE: Obi rope in combination with joints stretches the rope infinitely - josemendez - 05-02-2022 (05-02-2022, 09:19 PM)jsladovic Wrote: Hi, Hi there! You mention your player is a rigidbody. How are you moving him around in response to user input? RE: Obi rope in combination with joints stretches the rope infinitely - jsladovic - 06-02-2022 (05-02-2022, 09:52 PM)josemendez Wrote: Hi there! Hi, appreciate the quick response. My player is moved by setting the rigidbody velocity to the movement vector of the player. Basically something along the lines of this: Code: Rigidbody.velocity = MovementVector * MoveSpeed; RE: Obi rope in combination with joints stretches the rope infinitely - josemendez - 06-02-2022 (06-02-2022, 10:49 AM)jsladovic Wrote: This code basically tells your character: "discard your current velocity, which might be the result of external forces/accelerations such as gravity, wind, drag, other joints, pulling forces applied by the rope, etc. and replace it with this vector". As a result, your character will move according to user input and ignore everything else. This way, only kinematic interactions will work (things that modify the character position directly, such as collisions). If you want to keep the effect of external forces (this includes the rope), you want to modify the current velocity, not replace it. Either use +=, or use AddForce(). kind regards, RE: Obi rope in combination with joints stretches the rope infinitely - jsladovic - 08-02-2022 (06-02-2022, 12:12 PM)josemendez Wrote: This code basically tells your character: "discard your current velocity, which might be the result of external forces/accelerations such as gravity, wind, drag, other joints, pulling forces applied by the rope, etc. and replace it with this vector". As a result, your character will move according to user input and ignore everything else. This way, only kinematic interactions will work (things that modify the character position directly, such as collisions). Thanks! Really appreciate the response, I had no idea it worked this way, I'll try to rework the movement script. RE: Obi rope in combination with joints stretches the rope infinitely - jsladovic - 17-02-2022 Just to let anyone else looking into the issue know that it really did help. Also have to take into consideration the mass of the player Rigidbody. Originally I was able to stretch the rope despite using forces to move the player, but when I reduced the mass it started acting the way I want it to. Thanks Jose! I hope you don't mind me posting another question here, I wouldn't want to clog up the forum with a number of threads and it's (vaguely) related to the original question. Since I have a moveable object connected to the rope, I added the option to throw the object by adding a force to the rigidbody. When throwing the object without the rope connection, it normally flies off. When throwing the object connected to the rope, it looks as though it flies off, but it quickly gets pulled back by the rope forces, resulting in it not going anywhere. Is there a way to lessen the internal forces of the rope in order to have the connected object fly off normally? I tried playing around with the distance constraints, but without luck. RE: Obi rope in combination with joints stretches the rope infinitely - josemendez - 18-02-2022 (17-02-2022, 09:19 PM)jsladovic Wrote: Since I have a moveable object connected to the rope, I added the option to throw the object by adding a force to the rigidbody. When throwing the object without the rope connection, it normally flies off. When throwing the object connected to the rope, it looks as though it flies off, but it quickly gets pulled back by the rope forces, resulting in it not going anywhere. Is there a way to lessen the internal forces of the rope in order to have the connected object fly off normally? I tried playing around with the distance constraints, but without luck. Hi, (sorry I didn't see this question earlier!) You can change the "strength" of a given constraint type globally per solver, this is the "relaxation" factor for each constraint in the solver's constraints foldout. See the very end of: http://obi.virtualmethodstudio.com/manual/6.3/obisolver.html Note this is literally a global multiplier on constraint force: if you set it to 0.25 for distance constraints, all constraints will be multiplied by 0.25 so they will do 25% of the work they'd normally do each frame. This should only be used as a quick way to change the behavior of all constraints in the solver, as it isn't physically correct: it does not have things like the amount of time passed since last frame or relative object mass into account. A generally better way to change constraint strength is to set their compliance. This can also be changed on a per-rope basis. Compliance is the inverse of stiffness, more compliant constraints are "softer". Try setting your rope's distance constraint compliance to a small non-zero value like 0.02, that will make the rope more elastic, fully taking timestep and masses into account. |