week 8


Creating cubes as constant objects:

the example on Moodle looked like this:

Cube1 = Cube("Cube1", 20, 10, 10, 10) # create Cube1
Cube2 = Cube("Cube2", 40, 10, 10, 10) # create Cube2
Cube1.move(100, 0, 0) 
Cube2.move(-100, 0, 0) 
Cube1.rotate(0, 45, 0) 
Cube2.rotate(0. -45, 0) 

In order to better understand this code, I will now break it down to demonstrate my understanding of object generation and positioning.
The first line creates a cube and generates its dimensions. it then assigns the cube data to the variable name 'Cube1'.

The second line does the same, but with different dimensions and assigns the data to the variable name 'Cube2'.

the third line moves cube1 along the X axis, by a value of 100.

the forth line moves cube2 along the X axis in the opposite direction.

the fifth line rotates cube1 along its Y axis by 45 degrees. 

the sixth line rotates cube2 along its Y axis by -45 degrees.


I'm still learning how this works as this whole idea of moving and generating objects in 3D is something I haven't tried before. 

Im going to do more work on this during the week as I am struggling to understand how variables work in the context of Maya 3D primitives.

Files

BubbleSort.py 2.3 kB
Dec 11, 2022

Get programming for animation

Leave a comment

Log in with itch.io to leave a comment.