Creating the buildings



  • The code imports the cmds module from Maya, which provides functions for interacting with the Maya API.
  • The generate City function is defined to generate the city buildings. It uses a for loop to create 100 buildings.
  • Inside the loop, random values are generated for the width, height, and depth of each building using random.uniform(min_value, max_value). Adjust the min and max values to control the size range of the buildings.
  • Random x and z coordinates are generated to position each building within a specified range.
  • The cmds.polyCube() function creates a cube mesh with the specified width, height, and depth. The name argument is set to 'building{}'.format(i) to give each building a unique name.
  • Finally, the cmds.move() function is used to move each building to its randomly generated position.

Overall, this code creates a visually interesting cityscape by generating random buildings with varied sizes and positions using Maya's cmds module.

Leave a comment

Log in with itch.io to leave a comment.