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.


1 comment:

  1. Hi, Back in 2011 I had made some horse-animations with Alice 2.2 - the demo of the procedures is here: https://www.youtube.com/watch?v=e3atPRp6mqg and the final dressage-routine is here: https://www.youtube.com/watch?v=dTkNCuOX_T0 . Now with Alice 3.X, is the code still usable? I can redo it all in Alice 3.3, but shall it become obsolete once again with 4.x? Thanks!

    ReplyDelete