Objects and Properties

Download Report

Transcript Objects and Properties

Objects and Properties
Alice
Objects in Alice
Objects already exist. Hundreds of them
Objects
In 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 perform
tasks 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 name
mummy, mummy1, mummy2
has color(s)
pink, white, grey, black, blue, ….
Objects in the World
Can have multiple instances of objects
from the same class in the World
class: like a cookie cutter
objects: like the cookies
star cookie cutter
star cookie class
star cookies
star cookie objects
Objects in the World
penguin class
penguin objects in a virtual world
Object Dimensions
Objects in Alice worlds are 3 dimensional
height
width
depth
Objects “Know” Relative Directions
Yellow box around
penguin is its
bounding box
light blue line is
up/down
pink line is left/right
dark blue line is
forward backward
DEMO
Galleries of 3D Objects
Sources of 3D objects
the local gallery shipped with the software
Alice web gallery
Objects in a Virtual World
In 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)
orientation
color
opacity
vehicle
Changing Properties of Obejcts
Properties of Object can be
changed
Location can be changed by
clicking and moving object
Orientation can be changed
in the “Add Objects” View
Other properties, such as
color, can be changed in the
properties window when the
object is selected
Object Parts
Objects 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 objects
A 3D object has
3 dimensions
height, width, depth
6 degrees of freedom (directions of movement)
Distance
object’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 World
The world in an Alice
program models a 3D
space
every object in the world
has a position
x, y, z, coordinate relative
to the center of the world
ground starts at center of
world
axes (green = up, red =
right, blue = forward)
Vehicles
Each 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 Property
Select 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