TB1 Week 7
Began working on scripts which would generate pyramids in Maya automatically at the press of a button.
Initial attempt was made by using a function which would repeatedly create a cube at the correct place each time.
import maya.cmds
def Pyramid(width, height, depth):
cmds.polyCube(w = width,h = height,d = depth)
cmds.polyCube(w = width-1, h = height, d = depth-1)
cmds.move(0,1,0)
cmds.polyCube(w = width-2, h = height, d = depth-2)
cmds.move(0,2,0)
cmds.polyCube(w = width-3, h = height, d = depth-3)
cmds.move(0,3,0)
Pyramid(4,1,4)
Afterwards, I managed to improve the script by making it use a for loop to make it generate the cubes, their scale and placement correctly each time.
import maya.cmds
def Pyramid(width, height):
for x in range(1, width+1):
cmds.polyCube(w = x, h = height, d = x)
cmds.move(width, moveY = True)
width = width-1
Pyramid(5,1)
Programming for Animation Devblog
Status | Prototype |
Category | Other |
Author | Pomanchocho |
More posts
- TB1 Week 10Dec 05, 2022
- TB1 Week 9Dec 05, 2022
- TB1 Week 8Dec 05, 2022
- TB1 Week 6Dec 05, 2022
- TB1 Week 5Dec 05, 2022
- TB1 Week 4Dec 05, 2022
- TB1 Week 3Dec 05, 2022
- TB1 Week 2Dec 05, 2022
Leave a comment
Log in with itch.io to leave a comment.