17 lines
514 B
GDScript3
17 lines
514 B
GDScript3
|
|
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
|