How do I make a pendulum using pin joints?

Godot Version

Godot 4.5

Question

I’m trying to make a crane game, and I want the crane to dangle loosely, like a pendulum. This used to be the default behavior of a PinJoint2D and allowed things to swing or hang, but now the joint seems very rigid, and pinned physics objects only move if forced by another physics object; neither gravity nor the attached RigidBody2D’s “constant forces” variables can move said attached RigidBody2D.

I’d revert back to 4.3 when the PinJoint2D worked as I expected, but I need the node’s torque feature to work, and it was broken and only fixed in recent updates. So now I’m stuck where the fix for one issue breaks the other, and vice-versa.

Is there any way to make an object pinned with a PinJoint2D hang limply like a pendulum, while also retaining the ability to move it using torque?

Edit: For context, here’s a segment from the docs that outlines my exact use case. I am trying to use a PinJoint2D exactly the same way as the example in the docs. I’m using all the default settings, and it’s just not working as described.

Okay, further testing reveals I had the pinjoints in the wrong position in the scene hierarchy. Apparently they can’t be a parent or child of the rigidbody I’m trying to connect them to or this causes problems. So I made the pinjoints siblings of the crane arms and it works now. I’m not sure this is how it’s supposed to work, but it works.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.