How can i move objects along one axis with mouse in 3D, like in editor.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By teemoshido

For now this is the only thing that i could come up with, and doesn’t work that great, but for testing it had done it’s job

func _process(delta):

if _arrow != null and _move_event != null:
	
	var papa = _arrow.get_parent()
	var bunu = papa.get_parent().get_parent().get_parent()

	if papa.name == "y_up" || papa.name == "y_down":
		if _move_event.speed.y < 0 and _move_event.relative.y < 0:
			_move_event.speed.y = - _move_event.speed.y
		bunu.translation.y -= sign(_move_event.relative.y) * _move_event.speed.y * delta * 0.1

	elif papa.name == "x_right" || papa.name == "x_left":
		if _move_event.speed.x < 0 and _move_event.relative.x < 0:
			_move_event.speed.x = - _move_event.speed.x
		bunu.translation.x += sign(_move_event.relative.x) * _move_event.speed.x * delta * 0.1

	elif papa.name == "z_right" || papa.name == "z_left":
		if _move_event.speed.x < 0 and _move_event.relative.x < 0:
			_move_event.speed.x = - _move_event.speed.x
		bunu.translation.z += sign(_move_event.relative.x) * _move_event.speed.x * delta * 0.1

I saved the InputEventMouseMotion and if i had a selected arrow i moved it, but it doesn’t follow the mouse how i would like to.