Main content
Pixar in a Box
Course: Pixar in a Box > Unit 9
Lesson 2: Code a character- Start here!
- 1. Creating objects
- 2. Representing a shape object in code
- Rigging a snowman 1 (building the body)
- 3. Putting shapes together
- Rigging a snowman 2 (adding a head)
- Rigging a snowman 3 (adding a hat)
- 4. Functions
- 5. Defining deformer functions in code
- Rigging a snowman 4 (coding deformers)
- 6. Connecting deformers and shapes with code
- Rigging a snowman 5 (adding and updating deformers)
- Project: Create your own character
- Project 2: Animate your character
© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice
3. Putting shapes together
Use an array to store many objects as well as create any shape you can imagine. Click here to review objects.
Want to join the conversation?
- I just do not get how this works. I got to part 4 and I am sssssoooooo confused.(4 votes)
- So when making the hat we are using something similar to the 'vertex' function in ProcessingJS?(3 votes)
- Yes, therefore, with these lessons, it can help to have taken the ProcessingJS lessons(1 vote)
- im confused i need rigging a snowman 3 plz help(1 vote)
- var shapes = [
{
name: 'body',
radius: 150,
center: [200, 250]
},
{
name: 'head',
radius: 80,
center: [200, 160]
},
{
name: 'hat',
vertices: hatVertices,
fill: color(0, 0, 0)
}(2 votes)
- Do a model so i can beter understand someone please(1 vote)
- help please? this rigging think is getting a tone complicated.(1 vote)
- I think maybe what you should do is do the intro to java script on kahn(1 vote)
- i re watched the video a couple times and im not even done part one! im so confused. can i get some help?(1 vote)
- is this JavaScript or something like it(1 vote)
- I will never have fun because I am stuck on the head part step 2/4!Have fun! (laughs) 1:39(1 vote)
- If you're stuck, just type in the code that is seen in the hint. But for the "center" part, just type in 200, 200 for the coordinates and then fix it from there.(1 vote)
- Who agrees with me? They should put movies on Khan Academy.(1 vote)
- Can someone help me with step 2 of Rigging a Snowman 3?
I managed to clear steps 1, 3, and 4. But I cannot see where I'm going wrong on step 2.(1 vote)
Video transcript
- [Narrator] Okay, so far you've
made a single shape object which contains information
to draw a circle, but we'll need more shapes
to build our snowman, and we'll want to store
all of these shapes inside one data structure, which represents our snowman model. One way we can do this is with an array, where each position in the
array holds one shape object. In the next exercise, you'll
define an array called shapes array to do this. Think of this shapes
array as our entire model. It has everything the computer needs to draw all the pieces of the model. But what about a hat for Nick? We can't draw that with circles... That would be crazy! The short film, Nick Nack, was made with simple geometric shapes. One easy way to draw any shape is to define a series of
points called vertices. For example, the hat would
need eight vertices like this. Each of these points is represented by a pair of coordinates. And then, the entire
list of these vertices can be stored in a larger array. So we'll have an array of arrays
to store any shape we want. And we'll let another part of the program actually connect these dots for us. First up, we have two exercises for you. In the first exercise, you'll be creating a shapes array to hold each of your shape objects. This will allow you to add
your head and your body. After that, you'll have a
chance to create any shape, starting with a classic, black hat. Have fun! (laughs) Yay! Go for it!