Animation in mjbWorld

This section covers all sources of movement in the scene including behaviours driven by the mouse and behaviours built in to the model such as physics.


Animate Loop

When Start is called the animate loop runs continuously, this alternately calls step then render.

Step and render are both called on sceneBean, which is the root of the scenegraph, and are then called on the subnodes so that they are called on all nodes in the scenegraph.

The reason that they are separate methods and not all done in the same method is that if there are many views we may have to render the scene many times before stepping on to the next frame.

If the animation loop is not running then, draw() can be called to do a render. If the animation loop is running then draw need not do anything.

Events

The program supports VRML type events. The events are defined by a route node which specifies the 'to' and 'from' nodes and properties. When start is called in mjbFrame, as well as starting the render loop as described above, start is also called on the scenegraph to allow the route nodes to setup the events.

The event mechanism is described here.

Built in Behaviours

The program allows the scene to be graphically edited, for example, selecting and dragging nodes to move, rotate or zoom them. Also graphically editing meshes.

 

 

The behavourBean, grappleBean and meshBean are in the view branch, this means that they are not saves when the scene is saved. They are more a built-in part of the program.

behavourBean

behavourBean is put in the view branch by default, this allows the mouse interface to select and move objects.

An instance of behavourBean will also appear in the scene branch when reading a VRML touchSensor.

The graphical interface only modifies objects under a transform group, it does this by selecting and modifying the transform group transform.

An instance of behavourBean is started by rootBean.initalise which passes a reference to the scene branch as the root of all pick behaviour.

grappleBean

This will select a transformgroup and modify it controlled by the mouse interface. An instance of behaviorBean is started by rootBean.initialise which passes a reference to the scene branch as the root of all pick behaviour.

meshBean


Classes written for this program Java3D classes (scene graph structure)

 

 


Behaviours

When the mouse is clicked on a node (assuming that it is not already selected) then the following needs to happen:

Selecting an object:


Moving a selected object


Sequence of Events


metadata block
see also:

3D theory - Physics

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

 

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2015 Martin John Baker - All rights reserved - privacy policy.