YG Basics: Loading Objects

To create an environment in YG, you first create 3D models of objects in a modelling program like Maya, 3D Studio Max, SoftImage, Form-Z, etc. You can then write a YG scene file to control where you want the models placed and to program animations, sounds, and interactivity. You can create models in many software packages, and you can also download many pre-made models off the web.

This set of examples uses some models of furniture and other household items. Download the model files and save them in your yg/data directory.

Test out the models using perfly. Open a terminal window, go into the data directory, and use perfly to look at them.

$ cd yg
$ cd data
$ ls
sofa.pfb armchair.pfb lamp.pfb coffeetable.pfb

$ perfly sofa.pfb
See the Using Perfly page for help with Perfly. Now to create your scene file. These instructions will assume you're using Kate for text editing, but you can use any other text editor (Nedit, Gedit, Jot, Emacs, XEmacs, Pico, Vi, etc). See the Kate Help for more about using Kate.

1. Go into your yg scenes directory and create a new scene file
$ pwd
/home/ben/yg/data

$ cd ..
$ cd scenes
$ kate livingroom.scene &
the pwd command is to check what directory we're currently in. creating a file with a ".scene" extension tells Kate that you are editing a YG scene file. It will apply syntax-coloring to your code, which makes it a little easier to read. remember that the "&" keeps the terminal window active while kate is running - if you leave that out, the terminal window will freeze until you quit kate. 2. Write the scene file

// a living room, created in YG

light ()

object (file("sofa.pfb"))

3. Save and run your scene In Kate, go to File->Save. Go back to the terminal window, go up to your main yg directory, and RUN your scene:

$ pwd
/home/ben/yg/scenes

$ cd ..
$ RUN livingroom.scene
If you have problems, see the Debugging Page for help.

(c) Ben Chang