Good day everyone,
I got a small problem here, I've an Raycast node attached to a Camera, now the Raycast looks for the right meta type once it collides with something.
If the Raycast gets close to an Node which has a set_meta() then everything works fine, but once my Raycast picks up an Node (or worse, then multiple Nodes get picked up) which doesn't have an set_meta(), then Godot kinda freaks out and spams an error for me:
ERROR: Condition "!metadata.has(p_name)" is true. Returned: Variant()
Im using Godot 3.4.stable.official.206ba70f4 (the standard one from Steam)
and GDscript.
I tried looking inside the Documentation if something got mentioned there but there is nothing, then I tried to Google the error message but I had no luck, then I tried to change in set_meta() that "type" to "_type" incase the name conflicts with something, but again, no luck.
Can I give a Node some meta data like the scripts does, or do I have to use a script to set an Node's meta data? Or do I check the Nodes the Raycast picks up wrongly?
player.gd
onready var interactionRay = $Camera/InteractionRaycast
func _ready():
set_meta("type", "player")
func _physics_process(delta):
if(interactionRay.is_colliding()):
var collidedObj = interactionRay.get_collider()
if(collidedObj.get_meta("_type") == "enemy"):
collidedObj.hide()
enemy.gd
func _ready():
set_meta("type", "enemy")
Thanks in advance.