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

Post on 14-Dec-2015

229 views 0 download

Tags:

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

Objects and Properties

Alice

Objects in AliceObjects 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

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, ….

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

Objects in the World

penguin class penguin objects in a virtual world

Object DimensionsObjects in Alice worlds are 3 dimensional

height width depth

Objects “Know” Relative Directions

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

Galleries of 3D Objects

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

Alice web gallery

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

class: penguin

objects: penguin, penguin2, penguin3

Problem

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

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

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

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

Object Parts

Objects may be composed of parts

3D objectsA 3D object has

3 dimensionsheight, width, depth

6 degrees of freedom (directions of movement)

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

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)

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?

Alter the Vehicle PropertySelect sax from object tree

Select properties tab

Change vehicle from world to snowman

Assignment

Read Tutorial03 Know what an object is instance of

Know how to use the properties

Read Tips & Techniques 2 Orientation and Movement Instructions

Lab 03

Penguin

Tortoise and the cookie

Mana and the magnet