I have a car scene and a zombie CharacterBody3D scene and I am trying make it so that when the car hits the zombie, the zombie starts physical bones simulation (and also deals damage based on impact, but that is the next step).
I have tried to implement this using an Area3D that surrounds the car and emitting a signal when the zombie CharacterBody3D enters the area to then turn on physical bones simulation, but I have something not setup correctly and not sure what it is.
Here is my script that is attached to the car's Area3D
Here is my script that is attached to the zombie
Here is how the area3D is setup on the car
Here is how the characterbody3d is setup on the zombie
Notice how the print is not printing when the characterbody3d enters the area3d...
I am thinking I either have the signal hooked up incorrectly or am missing some logic so that the signal isn't being emitted when the CharacterBody3D enters the area. Or I could be doing everything wrong here hah! Any help would be greatly appreciated! Cheers!
The signal is likely connected correctly. When a signal is connected from the editor, you should see the green icon here:
Unless you have connected the wrong signal, which is unlikely, that should be OK.
Now, check the collision_mask
of the Area3D
has overlap with the collision_layer
of the CharacterBody3D
, also make sure the Area3D
has monitoring
enabled.
You can also add a print
on the connected function:
func _on_body_entered(body):
print(body)
if body is CharacterBody3D:
body._on_body_entered()
That way you would know if this method is being called, and being called with the correct object.