Skip to content

Instantly share code, notes, and snippets.

@BransonGitomeh
Created May 28, 2020 17:57
Show Gist options
  • Save BransonGitomeh/8ec56b226f702c68e77234ab3ab31710 to your computer and use it in GitHub Desktop.
Save BransonGitomeh/8ec56b226f702c68e77234ab3ab31710 to your computer and use it in GitHub Desktop.
tool
extends Spatial
export var cluster_size = 3
# Called when the node enters the scene tree for the first time.
onready var box = preload("res://obj1.tscn")
func _ready():
print('cleaning up exising trees')
var boxes = get_tree().get_nodes_in_group("box_group")
print("found ",boxes.size()," boxes")
for box in boxes:
box.queue_free()
print('free_ing them from memory')
for x in range(cluster_size):
for z in range(cluster_size):
print(x,z)
var node = box.instance()
node.transform.origin = Vector3(
1 + x*3 + randi()%10+1,
1,
1 + z*3+ randi()%10+1
)
add_child(node) # Parent could be any node in the scene
node.set_owner(get_tree().edited_scene_root)
pass # Replace with function body.
#func _process(delta):
#$obj1.rotate_y(delta)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment