martes, 16 de abril de 2024

Script borra softbody3d de un personaje el vestido; godot 4.2; Script PARA RigidBody3D Y ALOS 3 SEGUNDOS LO BORRA ;

 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):

$"LA VIEJA/SoftBody3D".queue_free()

$"LA VIEJA/SoftBody3D3".queue_free()

$"LA VIEJA/SoftBody3D4".queue_free()

$"LA VIEJA/SoftBody3D2".queue_free()

pass # Replace with function body.

------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
EXPLICACION:  De un Area3d (donde e puesto el script) parten 2 hijos "la vieja" (un node3D) y el otro un CollisionShape3D....los SoftBody3D los cuatro diferentes del script son hijos del "la vieja" (un node3D) y nietos del area3d principal . funciona a la perfeccion cuando el player choca con  CollisionShape3D  se borra el vestido ,este ejemplo es de arriba, abajo otra variante que funciona en el cubo en la ropa no funciona............¡¡atencion estos scripts cuando repite  colisionar el juego se bloquea!! aun tiene fallos.........
--------------------------------------------------------------------------------------------------------------------------
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):
#$"LA VIEJA/SoftBody3D3".queue_free()
#$"LA VIEJA/SoftBody3D4".queue_free()
#$"LA VIEJA/SoftBody3D2".queue_free()
#$"LA VIEJA/CSGBox3Dgira".rotate_x(1)
$"LA VIEJA/CSGBox3Dgira".scale /= 2.5
$"LA VIEJA/SoftBody3D".scale /= 0.005
$"LA VIEJA/SoftBody3D2".scale /= 0.005
$"LA VIEJA/SoftBody3D3".scale /= 0.005
$"LA VIEJA/SoftBody3D4".scale /= 0.005
pass # Replace with function body.



------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------- 

ESTE DE DEBAJO SI FUNCIONA SIN PROBLEMAS , SE PONE A UN  RigidBody3D Y ALOS 3 SEGUNDOS LO BORRA NO NECESITA SEÑAL TAMPOCO.
-------------------------------------------------------------------------------------------------------------
extends RigidBody3D

var timer = 0.0

func _physics_process(delta):
# Incrementar el temporizador
timer += delta

# Eliminar el RigidBody3D después de 3 segundos
if timer >= 3.0:
queue_free()


No hay comentarios:

Publicar un comentario