![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | GreenTreeStudios-2.5 |
Good evening, it’s me again. I’m having trouble figuring out why my code is not changing the RayCast3D’s target position to the newly clicked position when the left mouse button is held down and the mouse is dragging:
This is the code I’m using:
var mouse
var cam = get_node("Camera3D")
@onready var cameraRayCast = get_node("RayCast3D")
mouse = get_viewport().get_mouse_position()
var from = cam.project_ray_origin(mouse)
var to = from + cam.project_ray_normal(mouse) * 100
cameraRayCast.target_position = to
if anyone can help me figure out what I’m doing wrong or what I’m missing, it would be much appreciated. Thank you in advance.