0
\$\begingroup\$

I'm connecting two moving rigidbodies using a spring joint in Unity. Between them, a rope will be rendered using a line renderer and I want it to move realistically as the joints move, without physics.

I've read about verlet integration, but only found examples where one point moves, and the other one is calculated, for example a guy with a grappling gun, swinging back and forth.

Here's the current implementation with spring joints.

The spring joints in action

The second image shows a nice and smooth verlet rope with a line renderer. It's a little too lenient, but looks good. As this doesn't use physics, it doesn't let me move the object or affect the ship, for example if it was stuck on something.

I want the rope to appear smooth

How do I make an elastic rope like the second image, between the spring joints, without the physics engine?

\$\endgroup\$
3
  • 2
    \$\begingroup\$ What do you mean without the physics engine? Verlet is an integration func.Do you mean to ask how to simulate the drawing of the rope so it looks nice like the second picture? One spring is not a great constraint to simulate rope, the rope will not look right with the stiffness of that spring. Typical rope is simulated via an array of springs. If you were to use the physics engine and create multiple springs attached between a set of invisible objects and render line between each joint, it would look better, but you may need to select the new physx to use something like that for space towing. \$\endgroup\$
    – Jon
    Commented Nov 29, 2020 at 7:41
  • 1
    \$\begingroup\$ Another option would be spline based rope and a distance joint if you really wanted to fake it till you make it. let us know more about what you’re trying to do and i’d be happy to explain in an answer \$\endgroup\$
    – Jon
    Commented Nov 29, 2020 at 7:45
  • 1
    \$\begingroup\$ Hi, thanks for the replies. I studied verlet integration and I will post an answer to my question. I meant without using the physics features in Unity. \$\endgroup\$ Commented Nov 30, 2020 at 11:09

1 Answer 1

0
\$\begingroup\$

The solution was quite simple when I studied Verlet integration enough.

By pinning the start and end points to the ship and scrap pile, and then using points and sticks to constrain the points between, I managed to make the rope work exactly like I wanted.

I used this page to learn the details: http://datagenetics.com/blog/july22018/index.html

I also had much us of this video course (4 parts): https://www.youtube.com/watch?v=3HjO_RGIjCU

Now I'm at the problem that space towing doesn't look good with a spring, but that's a problem for another question. Check that question here as it's related.

\$\endgroup\$
1
  • \$\begingroup\$ This answer currently doesn't explain much on its own. Can you elaborate? \$\endgroup\$
    – DMGregory
    Commented Apr 29, 2022 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .