Using Godot3, I have a camera and added a MeshInstance node to the Spatial node and attached this script. Why am I not seeing any triangle yet?
extends MeshInstance
func _ready():
var size = 10
var st = SurfaceTool.new()
var mat = SpatialMaterial.new()
mat.albedo_color = Color(1.0, 0.0, 0.0)
st.set_material(mat)
st.begin(Mesh.PRIMITIVE_TRIANGLES)
st.add_uv(Vector2(0, 0))
st.add_vertex(Vector3(-size, -size, 0))
st.add_uv(Vector2(1, 1))
st.add_vertex(Vector3( size, size, 0))
st.add_uv(Vector2(1, 0))
st.add_vertex(Vector3( size, -size, 0))
st.generate_normals()
var mesh = st.commit()
self.set_mesh(mesh)