0 votes

I am trying to change the Spatial properties with a get_node, I am trying to change the position like this, how to receive the properties of a Spatial and then change the position ?

 tool
 extends Node  

 export(NodePath) var pathOfNode
 # node path is "../Spatial/LEVEL-MESH"

 export(bool) var runThis = false setget RunningThis

 func RunningThis(value):
    get_node(pathOfNode).position = Vector3(0,0,0)
    pass
Godot version 3.3.2
in Engine by (335 points)
edited by

What kind of node are you moving? position property changes depending on the type.

I am also not sure why you're using a setgetter for this when you're disregarding the value passed.

I have not used the path with "../" myself so not sure if it works. I know get_parent() works though, so something like:

 export(NodePath) var pathOfNode
 # node path is "Spatial/LEVEL-MESH"

 func reset_position():
    get_parent().get_node(pathOfNode).position = Vector3(0,0,0)

You checked get_node().translation = Vector3(0, 0, 0) as said here?

Thanks I was using position

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.