Hi, Community!
I am writing a mesh by SurfaceTool object in Godot 3.2.2. I try to set the colour of the mesh vertices and surfaces by adding a material with a colour, or by using MeshDataTool to access the vertices to change the colour. But the colour stays "Black".
The following is my simple code:
# mesh
var tmpMesh = Mesh.new()
var vertices = PoolVector3Array()
var mat = SpatialMaterial.new()
var color = Color(225,0,0,1)
var st = SurfaceTool.new()
# add color to the surface
mat.albedo_color = color
st.set_material(mat)
# draw mesh
st.begin(Mesh.PRIMITIVE_TRIANGLE_STRIP)
for v in vertices.size():
st.add_color(color)
st.add_vertex(vertices[v])
st.commit(tmpMesh)
mesh = tmpMesh
How could I fix it up?
Thank you in advance!
-Eden