1 / 21

Wonderland in Squeak

Learn how to use the Alice-based 3-D world in Squeak with Wonderland, an implementation of Alice for Squeak. Explore various features such as camera morph, working with objects, animations, controlling time, and more.

sandidge
Download Presentation

Wonderland in Squeak

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Wonderland in Squeak How to use the wonderful, Alice-based 3-D world in Squeak — Mark Guzdial

  2. 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.

  3. Wonderland Wonderland Camera Morph Some generic work space Wonderland Editor

  4. Playing with Balloon 3-D

  5. 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

  6. 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’

  7. 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:

  8. 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

  9. Working with the Camera • camera move: back distance: 3 • camera turn: left • cameraWindow showCameraControls

  10. Getting rid of things • Every Wonderland Actor understands destroy • They also understand hide and show • But don’t worry about it—infinite undo in the WonderlandEditor

  11. 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}.

  12. 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)

  13. More basic commands • bunny resize: 2 • bunny 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.

  14. 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)”

  15. 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 ].

  16. Using Alarms • myAlarm := Alarm do: [bunny turn: left turns: 1] in: 5 inScheduler: scheduler • scheduler getTime

  17. Additional Cameras • (Beware of speed!) • w makeCamera. • camera1 moveTo: {0. 2. 0}

  18. 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

  19. Blending 2-D and 3-D • camera turnBackgroundOff. • ground hide. • cameraWindow move: right distance: 50. • bunny move: right distance: 5

  20. 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).

  21. Getting rid of the editor • In workspace: • w := Wonderland new. • w getEditor hide. • (w getNameSpace at: ‘shark’) torso tail turn: #right

More Related