How to generate a Rectangle Mesh in code

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

I want to procedurally generate a small 3d city, I already created the code for a simple road generation using GridMap and an adaptation of a maze algorithm, now I want to generate houses but I cant find out how to create a simple rectangle 3D shape in code.

:bust_in_silhouette: Reply From: JayJay99

find out. This quite simple actually.

var myMesh =
myMesh.mesh =
myMesh.mesh.size = Vector3(5, 2, 1)


Hope you don’t mind if I pick this old question back up.

We’re using GDscript2 now, in Godot4, but the code still works. I can see the cube in the game window, but it’s not in the view port, and, crucially, it’s not in the scene tree.

Why can’t I see it there?

Curiously99 | 2023-06-01 17:43