Hi! I am looking for some code example or tutorial to create a grid movement in 3d. I found some youtube tutorials, but the are not working on current godot versions. The same thing about forum discussions.

Welcome to the forums @"Red Tardis"!

Do you mind linking to tutorials and/or discussions that show what you are looking for? It is probably possible to update the code so it works with the latest Godot version, or the links could be used as reference when helping.

I have not made too many grid-based 3D games, but I've always used something like this when I need grid-based movement in 3D:

# example:
var grid_position = Vector3(0, 1, 5)
const GRID_SIZE = 1.5

func _ready():
	global_transform.origin = grid_position * GRID_SIZE
	
	# to move the character in the grid:
	grid_position.x += 1
	global_transform.origin = grid_position * GRID_SIZE

# some helper functions (optional):
func world_position_to_grid_position(p_world_position):
	return (p_world_position / GRID_SIZE).round()

func grid_position_to_world_position(p_grid_position):
	return p_grid_position * GRID_SIZE	

func move_node_in_grid(p_offset):
	grid_position += p_offset
	global_transform.origin = grid_position_to_world_position(grid_position)
2 years later