Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | damncoder | |
Old Version | Published before Godot 3 was released. |
I have a 3d cube, and i want to move it with mouse cursor. All i find about this topic its a raycasting example:
var ray_origin = camera.project_ray_origin(get_viewport().get_mouse_position())
var ray_direction = camera.project_ray_normal(get_viewport().get_mouse_position())
var from = ray_origin
var to = ray_origin + ray_direction * 1000.0
var space_state = get_world().get_direct_space_state()
var hit = space_state.intersect_ray(from, to)
But it did not help me in solving the problem. Any ideas?
I found function “camera.project_position()”, but i didnt understand how it works…
Thanks in advance.