This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I have a node upon which I use a method. when I instance it in the main scene the method doesn't pick up with the new node. The code looks like this:

onready var cube = preload("res://theCUBE/MeshInstance.tscn")
const SPEED = 0.005
var sw=0

func tmesh(mesh, sbody, labt, labs, labr):
etc etc etc

func process(delta):
tmesh($MeshInstance, $MeshInstance/StaticBody, $MeshInstance/Viewport/VBoxContainer/Labelt, $MeshInstance/Viewport/VBoxContainer/Labels, $MeshInstance/Viewport/VBoxContainer/Labelr)
if Input.isjoybuttonpressed(0,1):
print("da")
var newm = cube.instance()
get
node(".").add_child(newm)
newm.translation = Vector3(0,0,0)

how can I call the method tmesh on the new instance? I tried taking all the children and subchildren of the new instance but I couldn't make it work. Is there another option?

Godot version 3.4.4
in Engine by (31 points)

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 Frequently asked questions and 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 [email protected] with your username.