Behaviour Framework

  • Email
  • Sharebar
  • Email
No replies
Yeh
Yeh's picture
Offline
Editor
Joined: 01/07/2013

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 Events
 
CLICK id action
Perform action when object id is clicked. 
REMOVECLICK id
RMCLICK id
Remove click event on the object id.
 
For Actions
 
UPDATE name id attr value
Create an update action named name, which updates the attribute attr of object id with value. value can be number, word or list.
TOGGLE name id attr
Create a toggle action named name, which toggles the attribute attr of object id. The attr must be an attribute with values true or false.
RMACTION name
REMOVEACTION name
Remove the action named name from the internal action registry. Note: this will not remove the effect once it has been associated with an event onto an object.

For example:

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.