2d Similar to Chained Together help

Godot Version

4.3

Question

Hi, I am trying to make a game similar to the game Chained Together, and I am running into issues using a characterbody2D.

My idea for a chain linking the players was to use a pinjoint, but after connecting from a rigidbody chain to one of the characterbody2D it does not work as I intend. It sticks to the characterbody2d fine but when another characterbody2d, connected on the other side of the chain, moves, it dislocates the chain from the other body til I release action.

I intend on having the chain tug and move the other player when a player moves away or falls, similar to Chained Together, but the chain just breaks and there is no connection, it is almost like the chain isnt there at all.

I experimented with a rigidbody character player and the chain tugs on the other player, but as a relative beginner I don’t fully understand coding Rigidbody Char movement and would rather use Characterbody2d as it seems much more simple and intuitive

help

Unfortunately, with a CharacterBody2D, it is not as simple as just pinning a chain to it as allowing the physics engine automatically do it’s thing.

The whole point of a CharacterBody is to have fine controls on how physics is applied to the body while still allowing it interface works other physics bodies in the scene. This means, if you need a chain to pull on a character body, when the chain is pulled, you have to find a way to tell the CharacterBody to move by manually changing it’s velocity with move_and_slide() or move_and_collide().

There is no simple plug and play for this with CharacterBodies, you have to actually code it and fine tune it till it feels right.

1 Like

That makes sense.

How could I go about coding in the Character Body to move along the “chain”. Thought about getting the distance between the players and trying to move them with each other in a way but maybe there is a better or simpler way with the pinjoints and rigidbody chains I have set up?