Hey all, working on a simple click to move game, using a GridMap to do level building which is working wonders for me, but I can't seemt o figure out how to get it to work with click to move. I've followed a few tutorials, but they don't work with a GridMap. Here's what I've got so far (give me a minute to get the formatting correct, still new to the way Godot forums does their stuff)
func get_world_pos() -> void:
var mouse_pos = get_viewport().get_mouse_position()
var ray_length = 100;
var from = camera.project_ray_origin(mouse_pos)
var to = from + camera.project_ray_normal(mouse_pos) * ray_length
var space = get_world_3d().direct_space_state
var ray_query = PhysicsRayQueryParameters3D.new()
ray_query.from = from
ray_query.to = to
var result = space.intersect_ray(ray_query)
print(result.position)
navigation_agent.target_position = result.position
usually when I try to make this work and click on a GridMap object, I get this error:
"Invalid get index 'position' (on base: 'Dictionary')
Any ideas? Any tutorials on this?