Help with simple collision

Godot Version

4.3

Question

I am trying to make a simple game where if a ball falls out of bounds it is “killed” by the kill box/kill zone. I can’t seem to understand how this is supposed to work in Godot.

This is the scene

I have an Area3D called “killbox” below the sphere that the sphere should fall through and be killed by. In the editor I have connected the “area_entered” signal from the Area3D node to the ball node (a rigidbody3d with a collisionshape3d).

Here is my simple script for the ball (attached to the rigidbody3d).

extends RigidBody3D


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	print('ready')
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	pass


func _on_killbox_area_entered(area: Area3D) -> void:
	print('killed')
	pass # Replace with function body.

However, when I start the game, the ball falls but “killed” doesn’t get printed. Indicating that _on_killbox_area_entered isn’t being called. What am I missing here? Is there more setup to do?

You wrongfully used the area_entered signal which detects if another area entering in it. You should use the signal body_entered because you have rigid body as player.

2 Likes

Aha! That fixes it. Thank you very much! I was reading area_entered as “something has entered the area”

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.