Thursday, 18 July 2013

Alice 3D Programming Training for Students

The Alice 3D Programming Training for Students of KV Kanjikode will commence from next week (July third week). 

The interested students (both the first batch of students and those who wish to join) may contact the Librarian.


Variables are used to store data. It is a named storage location in the computer memory.
To use a variable in Alice we need to create it first. The creation of a variable is simple. Just drag the variable tile from the control area to the code area and provide a meaningful name, value type and initial value.

Example Using Variable
In this example we will use two variables to store the heights of theboy and thegirl and then display the values stored in the variables making use of the say procedure and mathematical function we have learned earlier.
 The steps involved:
1. Create a variable height_boy, value type Decimal Number and Initial value 0.25
2. Create a variable height_girl, value type Decimal Number and Initial value 0.25
3. Drag and drop the getHeight functions to the respective value places
4. Use the say procedure to display the values
The video below demonstrates how to achieve this.



The functions are available under the methods panel in Alice.
Functions are used to get various properties of an object. They are like procedures and returns a value. For example, you can get the height of an object which can be later used to compute or compare the value with another value.

You can see some of the functions listed for the object selected. For the example, we will use the function getDistanceTo to move the theboy move towards thegirl.

In the above video tutorial, first we used the turnToFace procedure to turn theboy to face thegirl.
Next statement is used to delay the action so that the movement will be visible (try this without the delay statement)
Then we added the procedure moveToward and selected the initial value for distance. Now we can make use of the function getDistanceTo to calculate the distance to be moved. See the regions being highlighted while we drag the function to the statement area. The function is placed in the distance value and theboy now moves towards thegirl.
Did you notice the problem here?
Yes! theboy has moved to thegirl now and is colliding with thegirl. Is this what we needed?
No. We need theboy to move nearby thegirl. So to avoid the collision we can make use of the mathematics operators to reduce the distance to be moved.
The video given below demonstrates how this can be achieved.

To use the mathematical function, click the outer arrow on right to the getDistanceTo function. Select Math from the dropdown list and then select the desired mathematical function (here getDistanceTo - ??? as we need to reduce some amount from the value returned by the function getDistanceTo) followed by the value as shown.

You can see that many mathematical operators (addition, subtraction, multiplication and division) with various options are available here.

Next: Variables

Wednesday, 13 March 2013

Get the new version of Alice - Alice 3.1.60

Dear Students
A new update for Alice is available for download at
The new version has got more 3D objects to try. New animals, plants, properties and a few vehicles are added in this version.

Wednesday, 20 February 2013

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!

Thursday, 14 February 2013

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!