Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | VLAHIN |
I need to copy Vector3 to a variable. But in this code Vector3 (0,0,0) is always passed.
var old_bomb = merge_block.get_node("Bomb")
var trans = (old_bomb.translation)
old_bomb.free()
Are you sure old_bomb.translation is not actually (0, 0, 0)?
It is also encouraged to use queue_free() instead of free() unless you have a specific reason not to.
skysphr | 2021-09-29 20:53
The object is removed and vector3 becomes the default (0,0,0). Because, as I understand it, it is not a value that is passed to a variable, but a reference to the value. After deletion, the reference becomes null and the value of vector3 is reset. I need to use these coordinates after deleting an object, but I don’t understand how to copy these values.
VLAHIN | 2021-09-30 07:31
Are you sure old_bomb.translation is not actually (0, 0, 0)?
I will check it.
VLAHIN | 2021-09-30 07:33
I’m an idiot. I took the wrong position. Apparently at night it is not worth writing anything, the attentiveness is poor.
VLAHIN | 2021-09-30 07:41