miércoles, 10 de enero de 2024

Script para Godot3d cuando algo entra en el area3d borra nodos hijos y nodos hermanos; mas complejo;

 extends Area3D



# Called when the node enters the scene tree for the first time.

func _ready():

pass # Replace with function body.



# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta):

pass







func _on_area_entered(area):

var parent = get_parent()

var Turbo = parent.get_node("Turbo")

var Turbo2 = parent.get_node("Turbo2")

var CollisionShape3DCARROCERIA = parent.get_node("CollisionShape3DCARROCERIA")

var ModeloElicopteroobj = parent.get_node("ModeloElicopteroobj")

Turbo.queue_free()

Turbo2.queue_free()

CollisionShape3DCARROCERIA.queue_free()

ModeloElicopteroobj.queue_free()

get_node("CollisionShape3D mas amarillo aun").queue_free()

get_node("MeshInstance3D SUPERAMARILLO").queue_free()

pass # Replace with function body.


Script para Godot3d cuando algo entra en el area3d borra nodos hijos y nodos hermanos;

 extends Area3D


# Called when the node enters the scene tree for the first time.

func _ready():

pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta):

pass


func _on_area_entered(area):

var parent = get_parent()

var Turbo = parent.get_node("Turbo")

Turbo.queue_free()

get_node("CollisionShape3D mas amarillo aun").queue_free()

get_node("MeshInstance3D SUPERAMARILLO").queue_free()

pass # Replace with function body.




EXPLICACION:

El script se pone en el Area 3d donde estan los elementos que borraremos cuando algo entre en dicha area3d contenedora tambien del script, esta parte son hermanos:

var parent = get_parent()

var Turbo = parent.get_node("Turbo")

Turbo.queue_free()

 

esta otra parte son hijos:

get_node("CollisionShape3D mas amarillo aun").queue_free()

get_node("MeshInstance3D SUPERAMARILLO").queue_free()

pass # Replace with function body.