Add colour to the tree trunk

This commit is contained in:
CJSatnarine
2023-12-31 13:15:36 -05:00
parent ac713facf8
commit c7eaea9e13

View File

@@ -73,10 +73,13 @@ def buildTree():
while counter <= treeHeight:
# Create the cube at that position.
bpy.ops.mesh.primitive_cube_add(size = size, location = (treeXPos, treeYPos, treeZPos), scale = (size, size, size))
# Save the active object
activeObject = bpy.context.active_object
# Increase the z position by 1 for the next iteration
treeZPos += 1
# Set the colour.
treeTrunkColour = createMaterial(0.195465, 0.004988, 0.020193, 1)
assignMaterial(activeObject, treeTrunkColour)
# increase the counter
counter += 1