Alice 3.1 Tutorial Part 6: Functions

Alice has got a set of functions that provides information regarding the any object as required like the direction, its size, its distance to or from another object etc. Functions also helps us to get inputs from the user so that interactivity can be provided in the animations. For example you can get the name of the user or you can ask the user how much an object is to be moved and in what direction. Based on the user inputs you can code to manipulate the objects in different ways.

Besides, access to various body parts of an object is also obtained using the functional methods. You can find many functions listed which provide access to the internal joints of an object. The available joints depends on the individual object. Though some of the joints may be similar to all the objects belonging to a particular class, each individual object may have some joints that are specific to that object only.

Getters or Functions to get the dimension values of an object


In the image shown here, the three dimensions of the object girl can be accessed using these functions.

For example, you have two objects on the stage - one boy and one girl. You can resize the girl to make that object's size equal to that of the object boy using setHeight procedure






First we will drag and drop the code this.girl.setHeight to the code editor. Initially we may select any value.
Next, select the object boy in the object tree and click on Functions tab on methods panel. When you click on the code this.boy.getHeight, you can see Alice highlighting the value in the code editor where you can place the function.

When you click run the code will be executed resizing the girl to the same height as the boy. Observe that the three dimensions are automatically resized proportionately. 

If you use any of the procedures below instead of the setHeight procedure mentioned in the first step above, the object will be resized in one dimension only.


will be continued...


Alice 3.1 Tutorial Part 5: More Programming in Alice

You have learned the basic movements in the Begin to Program tutorial
Now we will see some more procedures available under the methods panel. You can also make custom procedures using these built-in methods.

Here we have the object cheshireCat selected in the object tree.
 The turn procedure turns the objects on their center point to left, right, forward and backward. When turn procedure is used, the object sense of forward will change accordingly.
The roll procedure rotates or rolls the objects on their center point to left or right ie. clockwise and anticlockwise. In roll procedure, the object's sense of forward remain unchanged. See the turn procedure used below to turn the boy to face the girl.

0.25 turns the objects at 90 degrees. A full turn of 360 degrees can be achieved by providing the value 1.

Both the turn and roll procedures can be applied to an entire object or a part of the object.

turnToFace the object will turn to face the other object selected as the argument (object will turn around its pivot point, so that its sense of forward will be in the direction of the target) and the pointAt procedure will rotate the object around its pivot point, so that its sense of forward will be in the direction of the target's pivot point. Both these procedures will look similar to the turnToFace procedure if you try it with two objects at the same level.
The difference will more clear in a scenario given below where we have applied both turnToFace and pointAt to the body part - right shoulder.



orientToUpright Animates a rotation of the object around its pivot point making the object to stand upright

orientTo the object will be rotated around its pivot point to have the same orientation as the target object.
straightenOutJoints gets the joints of an object to its original position.
Say is used to show the objects speak. A speech bubble will appear with the text you have provided.
Think works similarly, but a thought bubble will appear with the given text.

Resizing an object
The objects can be resizes at runtime using the following procedures.

When you set any of the three dimensions, the object will be resized proportionately. The size boy in our example above can be increased by the following procedure. We need to set only one dimension and the height and depth will be adjusted accordingly

Most of the procedures have an add detail parameter having the options asSeenBy, duration, and animationStyle which will affect the animation style of the objects.

Vehicle Property or setVehicle Procedure
Any object in Alice can be set to act as the vehicle of another object. When you set an object as the vehicle of another object both objects are synchronised and when the vehicle moves the other object will follow the same movement. An object cannot act as a vehicle for itself and two object cannot have a reciprocal vehicle relationship.
The vehicle property will be useful in the scenarios like a person riding a vehicle or horse or a pet follows its master. An object can be set as the vehicle of the camera so that the camera will follow the object when it moves.

Practice these procedures to get an idea of how they work.


First Animation by Sayooj

Sayooj Samuel has created an animation in Alice using the basic features we have covered in our first session. He has done a good work. I am sharing it here for you all!




Alice 3.1 Tutorial Part 4: Begin to Program - Alice Programming

Now, you have your objects placed on the scene, you can start programming.
Remember to save your work very often, to avoid losing your work if something happens crashing or hanging your system or Alice.
You have seen the Alice Code Editor earlier in Getting Started with Alice. The Alice programming involves dragging and dropping the procedure tiles from the methods panel to the code editor.  First, you need to select the object to be animated from object tree (see image below). 
Once you select an object, the procedures predefined for that particular object class will be listed in the methods panel.
The procedure will show the object name followed by the procedure name and arguments. The programming arguments initially displayed with ??? are additional information required to perform that particular procedure.
In the beginning the edit pane will have a shaded rectangle with Drop statement here where you can drag and drop the required procedures. Later when you try add more codes, it will guide you the placement with a green horizontal line indicating where the code will be placed once you drop it.

Let's have a demonstration of dragging and dropping a code tile. We have a bunny added to the scene, so let's now make him move.


In the above video you can see how the additional information like the direction to move and the distance to move was provided to the code statement.
Code Statement
The highlighted parts indicate that these values can be modified as required by clicking on the small arrow neat to them. The code tiles can be moved by clicking on the leftmost dotted area of the tile and dragging and dropping it. Pressing Ctrl key while moving the tile will make a copy of the tile. 

You can remove a tile by right-click->Delete.
The code tiles can also be disabled by Right-click->Is enabled.
The add detail button at the end of the tile lets you provide additional option for the statement. For example we have provided duration 2.0 here so that the movement will  be slow.
Once you have added the procedure tile to the code editor, click on Run button to test it.

Now take a look at the other move procedures available for Bunny.

Move: This procedure can be used to move the object in all six directions. While dropping the statement you will have to select the direction and distance.
MoveToward: Moves the object towards another object. Here you will have to select the object to move toward to and the distance.
MoveAwayFrom : Similar to the move toward this will move the object away from the other object.
MoveTo: Is used to move an object to another object. The object will move to the centre of the target you specify. You can adjust the position/distance using the mathematical options available (will be discussed later)
MoveAndOrientTo: This one is same as MoveTo statement, but here the orientation of the object will be adjusted to the target object..
Place: Used to place an object in relation to the other like in front of, right of, left of, below, above and behind.

So go ahead, try the move procedures!






Alice 3.1 Tutorial Part 3: Moving and Positioning objects

Once an instance of the object is added to the scene you may need to position them where you want the object appear on the scene initially when the animation begins.
The objects can be moved relative to their own orientation of sense of direction. You can position the objects by drag and drop method or by entering required x, y and z coordiate values or by using the procedures (to access procedures right click the object concerned).

1. Drag and Drop
Movement of the object using the drag and drop method depends on the handle-style selected.

There are four handle styles in Alice
If Default  handle style is selected (clicked) a surrounding ring will appear (see image A) and clicking and dragging the ring to the right or left you can rotate the object right or left to change the direction to which the object is facing.

If you click anywhere other than the ring, you can drag the object to move it in the four directions (i.e along the x and z coordinates). Coloured arrow marks will appear pointing the directions (Image B)
If Rotation handle is selected you can rotate the object in all directions clicking on the rings as seen in the image below.

The Translation handle let you move the object along all three coordinates (x, y and z) by clicking the respective arrows (image below) and dragging.
The Resize handle helps you to resize your object. Once the Resize handle is selected you can click and drag to make the object bigger or smaller.

2. Positioning and Resizing Objects by entering values
As you can see in the image below, you type in values in x, y, z boxes to position the objects. Also you can type the values for width, depth or height to resize the object. When you enter the value in one of the boxes, the other values will be changed proportionately.
Here you can also change the objects properties like the colour, opacity and vehicle. The property vehicle will be discussed later.

3. Moving objects using procedures
Procedures can be used to move and position objects on the initial scene. To call a procedure, right click on the object and select the procedure from the drop-downl list. While calling a procedure, you will have to provide the required values for the arguments like direction to be moved and the distance (see image below). We will use the same type of procedure in the code editor to create our animation.

Once the characters are ready on the stage, you may start programming/animating.


CAMERA CONTROLS
camera controls
The scene where you add the objects can be considered as you are seeing the scene through the camera view finder. You can re-position  your cameras or can change its angle so as to have a different view of the scene. The arrow buttons shown in the picture above are the camera controls that help you to move the camera in different directions.
There are three groups of buttons. The arrows in the group in the middle helps to orient your camera to the left, right, forward and backward. Click on the arrow concerned to orient your camera step by step or click and hold your mouse down to get a continuous motion. Clicking the left and right arrows is like you standing with the camera at a particular point shooting your scene, just turning the direction of the camera. Clicking on the forward and backward arrows is like you are moving toward or away from your scence to get a wider angle of the scene.
The arrow buttons on the left in above picture is used to move the camera in any of the four directions - left, right, up or down. Here the camera will move from one place to another.
The third group with two curved arrows can be used to tilt the camera downward or upward.
You just experiment with the camera controls and you will get the idea of camera controls quickly.


Next: Begin to Program

Alice 3.1 Tutorial Part 2: Adding Objects to the Scene

You need actors for your animation.
You can add the objects to the scene starting the Scene Editor. As shown in the previous section, you can click on the Setup Scene button to go to the Scene Editor.
The Scene Editor Interface for Alice is shown below.

Alice Scene Editor
The object gallery contains a good collection of 3D models.(Click here isit Alice website for a tour on object gallery) The gallery is organised into collections of  five classes based on mode of mobility and stored in five different folders namely Biped, Flyer, Prop, Quadruped and Swimmer. A sixth class Vehicles will be added later.
To view the gallery objects click on the folder. There may subcategories inside the folder. You will see the thumbnails of available objects in the gallery. You can also search using a keyword clicking on the Search Gallery tab.
Alice - Adding Objects to the Scene

You can add an instance of any object to the scene either by clicking on it or by dragging it to the scene. Either way you will be prompted to provide a name for your object. Accept the default name suggested by Alice or type in an identifiable name for the object (chose a name that will relate to the object rather than naming it abc, xyz etc. Spaces and special characters are not permitted)

Renaming and Deleting Objects
Renaming an object or deleting it from the scene is very easy. Just right-click on the object and select rename you will be prompted for the new name. To delete an object right-click on the object and select Delete.
One more option available on right-clicking on the object is Revert to original size. You can select this option to bring the object back to its original size.




Alice 3.1 Tutorial Part 1: Getting Started With Alice

Start Alice by double clicking on the Alice shortcut on your desktop.
When you start Alice, first a command prompt window will open (do not close this window) followed by Alice welcome screen.
First it will ask you to select a Template for your project or to open an existing project.
Select a Template

You can see four tabs in the above dialog box.
First one let you to select a suitable Template for your project. Second tab provides you access to your existing saved projects.Third tab will display your recent project and finally the fourth one helps you to open any project located in your system or in an external drive.
Click on the Template you would like to use for your project and then click OK button.

The Alice Interface

Alice Interface
Alice Interface
When Alice is first started with a new template, the camera is the selected object, the Scene view displays the selected template scene, and myFirstMethod (the main method defined for a scene) is the open tab in the Code editor panel.
The Code Editor Interface where you create your programming instructions to move an object. Adding the programming instructions is simple as it involves dragging and dropping the instructions available in the method panel.

The Methods Panel has got three tabs:
1. Procedures: Lets you perform some kind of action. Instructions of moving, turning, rotating etc. for your objects are available here.
2. Functions: These methods let you interact with user, ask questions, get values and get user inputs. 
3. Properties: As the name indicates this provides access to the methods related to the properties or characteristics like opacity, height, colour etc. of the object concerned. 

But before doing the programming part, we need our actors in place. You can add the objects/actors required for your Alice animation by clicking on the Setup Scene button above.

Next: Adding objects to the scene

Alice Training for KV Kanjikode Students - First Batch

The first batch of students were trained in Alice on 09.02.2012 from 10:00 to 12:00 in the LCD Room.
The list of students:

1
BIANKA THOMAS
IX C
2
SETHUKRISHNAN
IX C
3
SREEJITH G
IX C
4
VISWAJITH V.S
IX C
5
AMRITHA SP
IX C
6
ATHUL S
IX D
7
VARUN SHEKHAR
IX D
8
SOUNDER RAJ
VI A
9
Nandu
VI B
10
JISHNU K
VI D
11
SURAJ SASIKUMAR
VI D
12
ADWAITH
VII A
13
AKSHARA K RAJU
VII A
14
HISHAM
VII A
15
SREELAKSHMI KC
VII B
16
ASWATHY
VII C
17
D DHRISYA
VII C
18
ABHIJIT
VIII A
19
AMARESH
VIII A
20
JOEL BRIGHT
VIII A
21
LEVIN
VIII A
22
SREEHARI
VIII A
23
ALEN JOE ANTONY
VIII B
24
GAURI SANJANA
VIII D
25
MUKESH R
X B
26
ANJANA CP
X C
27
Baby S
X C
28
Preethi
X C
29
LAKSHMI
X D
30
RUKMA
XI C