An Event Driven Approach to Modelling Object Behaviour

Virtual Reality (
Thu, 28 Jul 94 11:58:54 BST

An Event Driven Approach to Modelling Object Behaviour

Peter Johnson
First Draft
July 1994

Department of Computer Studies
Napier University, Edinburgh
Craiglockhart Campus
219 Colinton Road
EH14 1DJ


This document is a proposed extension to "A File Format
for the Interchange of Virtual Worlds" by Bernie Roehl
and Kerry Bonin, May 1994. It attempts to provide an
interchangeable description of the behaviour of objects.
That is, the actions a user can perform on an object and
the outcome of that action; the semantics of object

The basic syntactic form, data types, and conventions
used here are adopted from Roehl and Bonin, thus
providing a seamless level of integration with the
existing language.


An event is some action the user makes with regard to an
object in a virtual world. An event may be associated
with an object through the use of the "Associated_with"

The "Event_list" is synonymous to a switch (case)
statement with an action being performed on receipt of a
particular event from the user. Each case is optional.
These are:

The user selected the object.

The user unselected the object.

The user grabbed (picked up) the object.

The user dropped the object.

The user walked into the object.

The object collided with another object.

This takes place if none of the specified
events match the actual event.

A distinction is made between selecting an object and
grabbing an object. For example, consider a light switch.
When the light switch is switched on the "Selected" event
will be posted, but when the user picks up the light
switch the "Grabbed" event will be posted.

The Event has the following format:

Name { STRING }
Application_handle { HANDLE }
Associated_with { ID }
Action { ... }
Action { ... }
Action { ... }
Action { ... }
Action { ... }
Action { ... }
Action { ... }

An Action has the following format:

Identifier { ID }
<C like procedure>

The identifier is optional and allows us to associate
other entities with the action, e.g. to play a sound when
a object is collided with.

The C like procedure is a subset of the C language
supporting the following:

num <id-name>;
real <id-name>;
boolean <id-name>:
while (<expression>) { ... }
if (<expression>) { ... } else { ... }
comment { STRING }

The "else" part of the "if" statement is optional.
The <expression> clause is of the usual C form, e.g.

x == 3.5
x = 3.14 * (0.123 / 180);
x && y || z

It may be desirable to add a "for" loop construct to this
as well as supporting C like comments. The "comment {
STRING}" construct is provided to maintain consistency
with the rest of the language. The same reasoning may be
applied to the use of "num" and "real" instead of "int"
and "float". It may be necessary to make variables local
to a particular action as well as global to the whole
Event definition. The addition of an array data type may
also be desirable.

The <manipulation-command> statement is used to modify
the object. It may be any of the following:

Translate(REAL REAL REAL )
Use to translate the object by X, Y, Z.

Use to scale the object by X, Y, Z.

Rotate(axis, ANGLE)
Use to rotate the object along the specified
axis, either X, Y, or Z, for the given angle.

Use to shear the object by X, Y.

Change overall color of the object.

Representation { ID }
Specify a new Shape for this object.

The "representation" tag allows us change the shape of
the object by pointing to a new shape description.

Additional manipulation commands may be provided which
allow the individual characteristics of an object to be
modified, such as the texture of a particular facet.


Virtual World Design Project
_/ _/ _/ _/ _/_/_/_/ Napier University
_/ _/ _/ _/ _/ _/ Department of Computer Science
_/ _/ _/ _/ _/ _/ 219 Colinton Road
_/ _/ _/ _/ _/ _/ _/ Edinburgh
_ _/ _/ _/ _/ _/ _/
__/ _/ _/ _/_/_/_/ SCOTLAND


"If you give an infinite number of monkeys an infinite number of graphic design
tools, they will produce something infinitely ugly" (Ben Elton 1993)