extends RigidBody3D @export var label3d: Label3D @export var move_speed: float = 3.0 # Called when the node enters the scene tree for the first time. func _ready(): pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): # move ball by cursor key var d = Vector3.ZERO if Input.is_action_pressed("ui_left"): d.x = -1 if Input.is_action_pressed("ui_right"): d.x = 1 if Input.is_action_pressed("ui_up"): d.z = -1 if Input.is_action_pressed("ui_down"): d.z = 1 if d != Vector3.ZERO: d = d.normalized() apply_central_force(d * move_speed) # get hit group var grp_name_list = ["bunker", "water", "green", "rough", "ob"] var txt = "" for grp in get_colliding_bodies(): for grpname in grp_name_list: if grp.is_in_group(grpname): txt += "on %s\n" % grpname label3d.global_position = global_position + Vector3(0, 1.2, 0) label3d.text = txt