Question about the joint2d

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dethland

Can joint2d connect two nodes, which have multiple children in them?

:bust_in_silhouette: Reply From: jgodfrey

Yes, it can. Have you tried it?

yeah, I try to connect two nodes. One has several rigidbody2d and Pinjoint2d, and the other one has a kinematicbody2d. I put these two nodes into one scene, and add a pinjoint2d to the scene. I try to use the inspector to choose the node_a and node_b, however, these two nodes are gray and not chosen able. Then, I try to use the script to connect them, but the result is they still go like two separate objects.
Is there any good solution for this problem?
and, thanks for the answer.

dethland | 2020-12-04 03:42

The nodes you assign to the joints must extend from PhysicsBody2D, so any of KinematicBody2D, RigidBody2D, or StaticBody2D. Those nodes can have children as necessary. Nodes that are grayed out when you attempt to assign them to the joint (I assume) do not extend from PhysicsBody2D.

Here’s a good overview and an example project…

jgodfrey | 2020-12-04 04:20