Scripting Tab

It is possible to control object behavior in animations using scripts. The Script tab contains an editor for this purpose. Scripts entered through the Script tab are executed last in the construction stack so they can be used for controlling other animation effects easily.

The Command Language gadget shows all installed script languages. With it, you can choose which language to use for the object.

You can enter the actual script to the text editing area below the language selector. For example, the following JavaScript program:

    Self.SetCenter(new r3Vect(0, 0, 0));

sets the center point to zero. The variable 'Self' refers to the object the script is associated with and SetCenter() is a method defined by the class in question.

Consult the Realsoft 3D JavaScript referece manual for more information about Realsoft 3D classes and the methods they define.

The following script controls the size of the sphere using the color attribute.

    color = Self.GetColor();
    Self.SetTotalTranslate(color);

To make sure the object don't go below 'y=0' level:

    t = Self.GetTotalTranslate();
    if(t.y < 0) {
        t.y = 0;
        Self.SetTotalTranslate(t);
    }

'Time' variable holds the current time allowing you to create animations easily. For example, to control the object's color in function of time:

    Self.SetColor(new r3Vect(Time, Time, Time));