Created
June 11, 2021 10:51
-
-
Save me2beats/484c837391037dbb3059ab3401394af3 to your computer and use it in GitHub Desktop.
simple grid for 3d (ImmediateGeometry)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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