Godot Version
v4.2.1.stable.official [b09f793f5]
Question
Hello! How are you, what happens is that the Raycast that I create and position using the same code as the one in the Godot Docs Raycast section:
# Godot Docs Version:
const ray_length = 1000
func _input(event):
if event is InputEventMouseButton and event.pressed and event.button_index == 1:
var camera = $Camera
var from = camera.project_ray_origin(event.position)
var to = from + camera.project_ray_normal(event.position) * ray_length
# My Version:
var MousePos = get_viewport().get_mouse_position()
var From = GameCamera.project_ray_origin(MousePos)
var To = From + GameCamera.project_ray_normal(MousePos) * 1000
$Main3D/RayCast3D.global_position = From
$Main3D/RayCast3D.target_position = To
but the Raycast would seem displaced if I move the camera, why would that happen to me?, thanks!
Video: