Trying to make a bridge using pinjoint2d and rigidbody2d

Godot Version

4.3

Question

I’m trying to make a dynamic bridge using rigidbody2d and pinjoint2d. I kind of made it work with minor issues but the biggest issue is when I scale it in my actual game scene it seems to mess up all the simulations.

ezgif-3-416063a906

This is the bridge with no scaling(too big) but it kind of works. But just as soon as I scale it, it seems to break the dynamics.

ezgif-3-9f73bf217f

I have a weird setup that will be very time consuming to get it right without scaling in the game scene.

I have a bridge segment

That I use in the combined bridge scene

In the bridge_comb scene I use two static bodies(the ends of the bridge that don’t move) and the bridge segments that are being used by the pinjoint2d nodes to connect each of the bridge segments. If it helps you can check this link (by @mokarrom) for how it works. I’m not sure if this is the most optimized/effective method to make a bridge but it seems to work okayish when unscaled. How would I fix this? Would also appreciate any tips on how to stop the bridge from bouncing.

Thanks in advance.

Be careful to never scale your collision shapes in the editor. The “Scale” property in the Inspector should remain (1, 1). When changing the size of the collision shape, you should always use the size handles, not the Node2D scale handles. Scaling a shape can result in unexpected collision behavior.

This is from the physics intro docs Physics introduction — Godot Engine (stable) documentation in English

So I’d assume you’ll have to adjust the bridge to the correct size without scaling any of the collision nodes.

2 Likes