Duplicating node showing showing in camera

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ZUHAYR RUSHD

I want the duplicate nodes to spawn, but the duplicates are not appearing in front of the camera. I attached a script to my camera which makes the camera go follow the duplicate but the duplicate nodes are not spawning levels as the duplicate nodes are appearing.

extends Spatial

var rand = RandomNumberGenerator.new()

onready var Levi = $i/RootNode/Plane002
onready var Levii = $ii/RootNode
onready var Leviii = $iii/RootNode/Plane
 onready var Leviv = $iv/RootNode/Plane003

var last_pos = 0
var new_lev = Levi
func _ready():

func _process(delta):
    var val = rand.randi_range(1,4)
    if val == 1:
        Levi.duplicate().translation = Vector3(last_pos + 2,0,0)
    elif val == 2:
        Levii.duplicate().translation = Vector3(last_pos + 2,0,0)
    elif val == 3:
        Leviii.duplicate().translation = Vector3(last_pos + 2,0,0)
    elif val == 4:
        Leviv.duplicate().translation = Vector3(last_pos + 2,0,0)

   last_pos += 2
:bust_in_silhouette: Reply From: jgodfrey

It doesn’t look like you’ve added the new (duplicated) nodes to the scene tree (via add_child()). You’ll need to do that before you’ll see them.

I really appreciate your help. I didn’t know it. I also really like how mush you help godot dev’s with there problem to grow the godot community.

ZUHAYR RUSHD | 2022-08-15 10:50

You’re welcome. :slight_smile:

jgodfrey | 2022-08-15 22:13