wonderland in squeak how to use the wonderful, alice- based 3-d world in squeak — mark guzdial
TRANSCRIPT
![Page 1: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/1.jpg)
Wonderland in Squeak
How to use the wonderful, Alice-based 3-D world in Squeak
— Mark Guzdial
![Page 2: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/2.jpg)
What’s Wonderland?
An implementation of Alice (http://www.alice.org) for Squeak Alice is a project of Randy Pausch Randy’s PhD student, Jeff Pierce, did
Wonderland as an intern at Disney
At CMU, Alice is used to teach film classes, to develop animations with interdisciplinary groups, etc.
![Page 3: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/3.jpg)
Wonderland
WonderlandCameraMorph
WonderlandEditor
Somegenericworkspace
![Page 4: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/4.jpg)
Playing with Balloon 3-D
![Page 5: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/5.jpg)
Starting With Wonderland
Wonderland new (In Squeak 3.1/3.2, from FileList, open a
model .mdl file)
Opens a WonderlandCameraMorph and Wonderland Editor Within editor: w is the current Wonderland camera is the current camera cameraWindow is the camera’s window
![Page 6: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/6.jpg)
Filling a Wonderland
Wonderlands understand 3D Design Studio and VRML w makeActorFromVRML: ‘blah.vrml’ w makeActorFrom3DS: ‘blah.3ds’
But quality tends to be low. Best: w makeActorFrom: ‘blah.mdl’
![Page 7: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/7.jpg)
Dealing with Wonderland Objects
Grab mdl files from: ftp://st.cs.uiuc.edu/pub/Smalltalk/Squeak/alice/Objects.zip
When you load the object, you have access to the overall objects and its hierarchy Messages are defined for you to make it easy
to walk the hierarchy
Basic commands: move:, turn:, moveTo:
![Page 8: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/8.jpg)
All Transitions Animate
When you command something to happen in Wonderland, it does over time (unless you say otherwise). bunny head setColor: green bunny turn: right bunny turn: right turns: 2 bunny turn: right turns: 1/2 duration:
rightNow bunny head turn: right
![Page 9: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/9.jpg)
Working with the Camera
camera move: back distance: 3camera turn: leftcameraWindow showCameraControls
![Page 10: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/10.jpg)
Getting rid of things
Every Wonderland Actor understands destroy
They also understand hide and showBut don’t worry about it—infinite undo in
the WonderlandEditor
![Page 11: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/11.jpg)
Animation Objects
Every action returns an Animation object. That’s why infinite undo is possible, and how actions can be easily chained
fd := snowman move: forward.rt := snowman turn: right.w doTogether: {fd. rt}.“w doInOrder: {fd. rt}.
![Page 12: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/12.jpg)
Constructing New Objects
Can use Pooh (demo)Can construct from pieces
makeActor makeActorNamed: makePlaneNamed:
bunny head becomeFirstClass “Now changes don’t propagate from parent”
bunny head becomeChildOf: ground bunny move: backward bunny color: (Color red)
![Page 13: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/13.jpg)
More basic commands
bunny resize: 2bunny roll: right. bunny standUp.moveTo: and turnTo: take a triplet {Left. Up.
Forward} in the parent’s reference frame bunny moveTo: {0. 2. 0}. bunny turn: left. bunny moveTo: camera. bunny alignWith: camera camera pointAt: bunny.
![Page 14: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/14.jpg)
Manipulating the Light
light place: onTopOf object: bunny.light color: (Color red). “or gray or
white”“Can also set the background, e.g.
ground color: (Color gray)”
![Page 15: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/15.jpg)
Controlling time
bunny move: forward distance: 5 speed: 1 bunny head pointAt: camera duration:
eachFrame. “bunny turn: right” bunny head doEachFrame: [ bunny head pointAt:
(camera transformScreenPointToScenePoint: (Sensor mousePoint) using: bunny) duration: rightNow ].
![Page 16: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/16.jpg)
Using Alarms
myAlarm := Alarm do: [bunny turn: left turns: 1] in: 5 inScheduler: scheduler
scheduler getTime
![Page 17: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/17.jpg)
Additional Cameras
(Beware of speed!)w makeCamera.camera1 moveTo: {0. 2. 0}
![Page 18: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/18.jpg)
Responding to Events
bunny respondWith: [:event | bunny head turn: right ] to: rightMouseClick. “bunny stop”
Also understands leftMouseDown, leftMouseUp, (and right equivalents) and keyPress
WonderlandEvent is the input type
![Page 19: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/19.jpg)
Blending 2-D and 3-D
camera turnBackgroundOff.ground hide.cameraWindow move: right distance:
50.bunny move: right distance: 5
![Page 20: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/20.jpg)
Textures
Set textures, including active ones: bunny head setTextureFromUser
An ActiveTexture (try BouncingAtomsMorph): camera getMorph enableDragNDrop. bunny body hasActiveTexture. "printIt to Check" bunny body setProperty: #activeTexture toValue:
true. "enable it" bunny body setTexturePointer: (RectangleMorph
new openInWorld).
![Page 21: Wonderland in Squeak How to use the wonderful, Alice- based 3-D world in Squeak — Mark Guzdial](https://reader035.vdocument.in/reader035/viewer/2022062321/56649ed15503460f94be04ba/html5/thumbnails/21.jpg)
Getting rid of the editor
In workspace: w := Wonderland new. w getEditor hide.
(w getNameSpace at: ‘shark’) torso tail turn: #right