0
\$\begingroup\$

I'm making a game in Unity where a ship can connect to a rock in space, and drag it. Both are Rigidbody2D. I want the ship to be affected by the rock like this:

  • If I drag the rock, then stop the ship, the rock keeps moving with the velocity it had.
  • If the rock gets pulled away by something, it should drag the ship when the rope is fully extended.
  • If the rock is heavy, the ship has more trouble pulling it
  • The rope might be a little elastic to make it more appealing

Is there a joint like this, or should I manually code it so they can affect each other? It seems like a basic game physics thing, but I can't find anything about it.

I tried using a distance joint with "Max Distance only" for this, but it doesn't work, as the rock stops when the ship stops:

enter image description here

For the visual part, I'm using verlet integration, with a slight gravity on the rope to make it more "springy", the current is a little too much but that's finetuning and not the problem of this question. :)

\$\endgroup\$
2
  • \$\begingroup\$ How are you moving your ship at present? \$\endgroup\$
    – DMGregory
    Nov 30, 2020 at 12:34
  • \$\begingroup\$ Using rb.AddForce with ForceMode2D.Force and rb.AddTorque for rotation. \$\endgroup\$ Nov 30, 2020 at 12:54

0

You must log in to answer this question.

Browse other questions tagged .