Behaviour Framework
The Behaviour Framework has been in the planning for a long time and finally it has come to implementation stage. For Web3D designers using X3DOM, they can design individual application with some sophisticated interactions. Applications usually are on a single webpage, in which scripts can be written in Javascript to control any DOM objects.
In VRMath2, however, it is a different story. The interactivity such as animation and behaviours have to be considered for use in the VRMath2 Editor (when viewing and editing), the Logo Editor (when programming), and the blogs (when sharing). Unlike most Web3D applications that are designed by professionals, VRMath2 is designed as an open environment to allow any users (learners, students, teachers, and graphics designers etc.) to design and program (in Logo) from simple geometrical objects to quite complicated virtual worlds (microworlds).
In this announcement, an initial behaviour framework has been implemented and demonstrated. In the virtual world below, you can click on the lamp's switch (a purple/pink cylindrical button) to see its behaviours (including toggle on/off light and play sound).
A blog was posted about the creation/programming of this Light with switch virtual world.
So what is a behaviour? In VRMath2, it is interpreted as an action performed when an event is triggered.
For example, an action could be "to turn on/off a light", an event could be "an object was clicked". A behaviour is the joint of event and action such as "when an object was clicked then turn on/off the light".
At this initial stage, the following Logo commands for behaviour have been implemented.
For example:
CS ; clearscreen DIRLIGHT ; create a directional light (obj_0, and the actual light's id is obj_0_dirlight) BALL ; create a sphere (obj_1) TOGGLE "action1 "obj_0_dirlight "on ; create a toggle action named action1, which toggles object's (obj_0_dirlight) attribute (on) between true and false. CLICK "obj_1 "action1 ; associate action1 with obj_1's click event. So when the sphere is clicked, it toggles the directional light.
More actions and events will be implemented later. You are most welcome to co-design this framework and/or provide your comments in the VRMath2 Editor forum.
There will also be GUIs for easy creating behaviours (Behaviour Editor) and animations (Data Collector and Animator). I will try to find time to implement during the coming busy teaching semester.