Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | usurun |
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
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)
db0 | 2021-07-19 08:14
You checked get_node().translation = Vector3(0, 0, 0)
as said here?
MxtApps | 2021-07-19 09:24
Thanks I was using position
usurun | 2021-07-19 09:26