WHY getting this error???

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

I’m trying to set the node_a of a PinJoint2D to a RigidBody2D but then I get this error:
Invalid set index ‘node_a’ (on base: ‘PinJoint2D’) with value of type 'RigidBody2D.
PinJoints are used to connect phisics bodies, so what the hell does this mean???

The code is like this:

get_node(“chain/PinJoint2D4”).node_a = get_node(“Box1”)

:bust_in_silhouette: Reply From: njamster

The documentation states clearly that the properties node_a and node_bare of type NodePath, not Node. So the correct way of doing this is:

get_node("chain/PinJoint2D4").node_a = get_node("Box1").get_path()