Kinematic body not detecting Area (3d) [RESOLVED]

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DaddyMonster

I’ve got a player ship (kinematic body) that’s currently picking up collisions:

func _physics_process(delta):    	
    var collision
	for y in active_craft.get_slide_count():
		collision = active_craft.get_slide_collision(y)
		print(active_craft.name, " collided with: ", collision.collider.name)

And an explosion with an Area on the same collision layer to the ship’s mask.

func _on_Shell_splash_down(position):
var player_id = get_child(0).name
if not get_child(0).has_node(str(player_id) + "Explosion"):
	var explosion = explosion_scene.instance()
	var area = Area.new()
	var col_shape = CollisionShape.new()
	var sphere = SphereShape.new()
	sphere.radius = 50
	col_shape.shape = sphere
	area.set_collision_layer_bit (19, true)
	area.add_child(col_shape)
	explosion.name = player_id + str("Explosion")
	area.name = player_id + str("Area")
	explosion.global_transform.origin = position
	get_child(0).add_child(explosion)
	explosion.add_child(area)
	explosion.get_node("Particles").restart()

I want the explosion to trigger the collision in the KB in order to deal damage. Can Area not be used with KinematicBody in this way or is there an error in my implementation?

Thanks in advance!

EDIT: It’s clear the collision on move and slide only picks up bodies. My instinct was to handle damage on the KB but the code is clearly set up to have the bomb / shell / bullet handle that. Closing this.

Does this implementation use signals? Are the signal connections properly setup? Is the Area checking for a body_entered() signal?

Ertain | 2020-12-12 18:59

The _on_Shell_splash_down method is receiving a signal but just for the explosion, regardless of whether there’s a hit. This makes an Area as a child with a SphereShape which I was hoping would be picked up by the KB (and so register a hit) but no dice. Ideally I want the KB picking up the Area as a collision, rather than the other way round.

DaddyMonster | 2020-12-12 19:47