Godot Version
4.2
Question
Why my script is not working when i click “v” it will spawning enemy
###script:
> extends Camera3D
>
> @onready var ray = $RayCast3D
> var object_scene = preload("res://enemy.tscn")
>
> func _physics_process(delta):
> if ray.is_colliding():
> var intersection_point = ray.get_collision_point()
> spawn_object(intersection_point)
>
> func spawn_object(position):
> var new_object = object_scene.instantiate()
> new_object.global_transform.origin = position
> add_child(new_object)