How to access PinJoint Node A/B Properties With Code?

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

I would like to make the Node B property of the PinJoint node a rigid body in the scene with code by pressing a button. Whenever I click the button it does not seem to work. If someone could explain this that would be great. Thanks in advance.

extends PinJoint

onready var block = $“/root/Spatial/Block”

func _on_Button_button_down():
set(“nodes/node_b”, block)

I have tested this code below to make sure the “block” is referenced correctly and it does work:

extends PinJoint

onready var block = $“/root/Spatial/Block”

func _on_Button_button_down():
block.gravity_scale = -5

Could you share a minimal godot project with this issue?

flurick | 2022-01-12 11:43