Skip to content

Instantly share code, notes, and snippets.

@me2beats
Created June 11, 2021 10:51
Show Gist options
  • Save me2beats/484c837391037dbb3059ab3401394af3 to your computer and use it in GitHub Desktop.
Save me2beats/484c837391037dbb3059ab3401394af3 to your computer and use it in GitHub Desktop.
simple grid for 3d (ImmediateGeometry)
extends ImmediateGeometry
export var offset = 0.01
export var grid_step = 1
export var grid_size = 10
func _ready():
begin(Mesh.PRIMITIVE_LINES)
var half_grid_size = grid_size/2.0
for i in range(-half_grid_size, half_grid_size+1):
add_vertex(Vector3(-half_grid_size*grid_step, offset, i*grid_step))
add_vertex(Vector3(half_grid_size*grid_step, offset, i*grid_step))
add_vertex(Vector3(i*grid_step, offset, -half_grid_size*grid_step))
add_vertex(Vector3(i*grid_step, offset, half_grid_size*grid_step))
end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment