2
\$\begingroup\$

I want to temporarily connect multiple RigidBody2D objects in a Godot 2D scene so they move together as one rigid body, and later split them up again.

I have basically managed to do so by dynamically creating two PinJoint2D instances and pointing them to the two rigid bodies. This way, the two rigid bodies are now connected to what looks and behaves like one rigid body.

However, now I want to vary the relative positions of the two rigid bodies with respect to one another. How do I do this? I have tried to modify the transform/position of the PinJoint2D instances, but this does not appear to have any effect.

\$\endgroup\$
2
  • \$\begingroup\$ I understand the initial part of the question, asking to attach/connect multiple RigidBody2Ds so they move together at once. I'm under the impression splitting them up means to simply sever this connection and have them move independently again. But later you mention you want to "Vary the relative positions of two rigid bodies with respect to one another". Can you go into more detail what exactly you're trying to do here? Do you want to displace them while keeping the connection? Sever connection and have them move independently? \$\endgroup\$ Commented May 17, 2024 at 20:46
  • \$\begingroup\$ @Domo106: Yes, the former - I want to displace them while keeping the connection. More precisely, I want to have object B move along with object A, essentially within A's coordinate system, while gradually moving B into a certain position with respect to A - all the while A keeps moving based on physics. \$\endgroup\$ Commented May 18, 2024 at 6:14

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.