Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | unfa | |
Old Version | Published before Godot 3 was released. |
I’m trying to cast a ray from object to current camera, but I never get any collision.
I have a Sprite3D object that has a RayCast child. It always returns false for is_colliding() method. What am I doing wrong?
extends Sprite3D
func _ready():
set_process(true)
func _process(delta):
var ray = get_node("RayCast")
var camera_pos = get_tree().get_root().get_camera().get_global_transform().origin
ray.set_cast_to(camera_pos)
print(ray.is_colliding())