Gallery/unfreeze.gd
2025-05-03 12:00:38 -06:00

17 lines
514 B
GDScript

extends Area3D
func _ready():
# Ensure the RigidBody3D child is frozen initially
var rigid_body = get_node("RigidBody3D")
if rigid_body:
rigid_body.freeze = true
func _on_body_entered(body):
# Check if the entering body is a Character3D or RigidBody3D and not a child of this Area3D
if (body is CharacterBody3D or body is RigidBody3D) and not is_ancestor_of(body):
print("body")
# Unfreeze the RigidBody3D child
var rigid_body = get_node("RigidBody3D")
if rigid_body:
rigid_body.freeze = false