How to use mgengine ?

This document explains how to use mgengine, 3D engine.

How to start ?

To launch the 3D engine, from a shell console, type :


The 3D engine will use the default environment data, which is the INRIA RA car park (if you correctly follow the installation instructions).

Once the 3D engine is running, you get a new window with a modelised car cark and the mgengine shell is prompted. This shell can be used to modifiy the behavior of the 3D scene objects.

What can I model using mgengine ?

  • Object : mesh (3d objects)
  • Input controller : mouse events, keyboard events manager
  • Observers: camera point of view
  • Compound Object: object link together (controller link to a 3d object)

How to use the mgengine shell ?

You can interact with the 3D engine using the script shell prompted when you launched the mgengine command.

Here are 4 basic helpfull commands :

  • help : print a list of available commands
  • list : print a list of objects loaded into the 3D engine
  • objectName.Help : every listed object given by list can invoke a Help “method” giving information on the available “methods” for the object.
  • run foo.script : execute the foo.script file.
The script shell is case sensitive.

How to create a new mgEngine scene ?

A mgEngine scene can be divided into 3 parts :

  • The data (meshes, materials, textures, etc.)
  • The script(s) to launch the scene
  • The configuration file(s) to indicate to mgengine where to find data end scripts

In our example, we create a main directory containing all the data and scripts, it contains 3 sub-directories :

  • materials : contains the materials (color of object)
  • meshes : contains the 3D meshes of each object
  • scripts : start script to launch the scene

The scene is composed of a green ground plane and a blue cube. You can download the scene here simple_scene.tar.gz and extract it in your home folder.

Then, we have to say mgengine wherer to find the ressource, to do that, we create a file simple_scene.conf in the directory ~/.config/mgengine/conf.d/

[data path] "/home/my_name/simple_scene/"
[material path] "$(material path);$(data path)materials"
[mesh path] "$(mesh path);$(data path)meshes"
[texture path]  "$(texture path);$(data path)textures"
[script path]   "$(script path);$(data path)scripts"

Now, you can launch mgengine :


and launch the main script :

mgEngine> run simple_scene.script

You should see something like that :

deprecated/howto/using-mgengine.txt · Last modified: 2010/02/26 14:05 (external edit)
Recent changes RSS feed Creative Commons License Donate Minima Template by Wikidesign Driven by DokuWiki