0 votes

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 onButtonbuttondown():
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 onButtonbuttondown():
block.gravity_scale = -5

Godot version 3.4.2
in Engine by (12 points)

Could you share a minimal godot project with this issue?

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.