22
Objects and Properties Alice

Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Embed Size (px)

Citation preview

Page 1: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Objects and Properties

Alice

Page 2: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Objects in AliceObjects already exist. Hundreds of them

Page 3: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

ObjectsIn the demo worlds, the octopus and skater are objects.An "object" is

anything that can be identified as unique from other things

How is an object identified as unique? has a name has properties:

width, height, color, location, age, ss#, id#

has a purpose:associated actions it can performtasks it can carry out

Page 4: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Objects in a Virtual World

In Alice, each 3D model is a class of objects

each object of the class has a unique namemummy, mummy1, mummy2

has color(s)pink, white, grey, black, blue, ….

Page 5: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Objects in the WorldCan have multiple instances of objects from the same class in the World

class: like a cookie cutter

objects: like the cookies

star cookie cutterstar cookie class

star cookiesstar cookie objects

Page 6: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Objects in the World

penguin class penguin objects in a virtual world

Page 7: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Object DimensionsObjects in Alice worlds are 3 dimensional

height width depth

Page 8: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Objects “Know” Relative Directions

Yellow box around penguin is itsbounding boxlight blue line is up/downpink line is left/rightdark blue line isforward backwardDEMO

Page 9: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Galleries of 3D Objects

Sources of 3D objects the local gallery shipped with the software

Alice web gallery

Page 10: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Objects in a Virtual WorldIn Alice, each 3D model is a class of objects

class: penguin

objects: penguin, penguin2, penguin3

Page 11: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Problem

Suppose I want a Penguin to disappear from the screen during the animation.

Page 12: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Solution

The solution is to change the opacity (degree of transparency) while the animation is running.Opacity is a property of the penguin object.All objects in Alice have properties, which include (among others):

location (x, y, z)orientationcoloropacityvehicle

Page 13: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Changing Properties of ObejctsProperties of Object can be changedLocation can be changed by clicking and moving objectOrientation can be changed in the “Add Objects” ViewOther properties, such as color, can be changed in the properties window when the object is selected

Page 14: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Object PartsObjects may be composed of parts

which may in turn be composed of parts

the whole object may be told to do something or an individual part

Page 15: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Object Parts

Objects may be composed of parts

Page 16: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

3D objectsA 3D object has

3 dimensionsheight, width, depth

6 degrees of freedom (directions of movement)

Page 17: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Distanceobject’s distance from each other are based on the distance between their center points

may look like objects are zero distance away, but actually centers still some positive distance away

Page 18: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Position in the WorldThe world in an Alice program models a 3D spaceevery object in the world has a positionx, y, z, coordinate relative to the center of the worldground starts at center of worldaxes (green = up, red = right, blue = forward)

Page 19: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

VehiclesEach object has a vehicle property

Initially the world is the vehicle for objects

can change this by altering the vehicle property for an object

Give the snowman an instrument

Change “ahem” to “toot”

What happens when movie played?

Page 20: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Alter the Vehicle PropertySelect sax from object tree

Select properties tab

Change vehicle from world to snowman

Page 21: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Assignment

Read Tutorial03 Know what an object is instance of

Know how to use the properties

Read Tips & Techniques 2 Orientation and Movement Instructions

Page 22: Objects and Properties Alice. Objects in Alice Objects already exist. Hundreds of them

Lab 03

Penguin

Tortoise and the cookie

Mana and the magnet