You can download the project used in this tutorial here: The cube_scene project.

Learning Goal

The goal of this tutorial is to demonstrate the project creation workflow and the structure of a project in PALAIS.


PALAIS works independently of any asset creation workflow you wish to employ. Thus you can use your favorite 3D modeling tool to create 3D models and scenes that can be imported in PALAIS. Examples of such 3D modeling tools are blender, 3ds Max and Maya.

Importing Assets in PALAIS

To be able to use your models in PALAIS you have to export them to the OGRE .mesh / .scene format. There are various exporters for many different modeling tools available. A list of available exporters can be found in the OGRE wiki.

Note that your modelling environment doesn't need to directly support exporting to the .scene format. Since most 3D modeling tools support exporting to standardized formats you can simply export to a common format and then use one of the modeling tools for which an OGRE exporter exists. You can employ the same workflow to convert any existing 3D models you wish to use to the .mesh / .scene format.

PALAIS will automatically import the assets you named in your project's meta data file in the resources and scene properties. You can find out more about the meta data file and projects in general in the tutorial Creating a New Project.

In this tutorial we will be using blender and the OGRE exporter to import a cube model in a PALAIS project.

STEP 1: Create Your Model

For demonstration purposes we create a simple cube object in blender. As stated above the workflow here is independent of PALAIS.

STEP 2: Export Your Model

Next we invoke the OGRE exporter via the File > Export > Ogre3D (.scene and .mesh) menu. Choose appropiate export options for your model and the file path to which you wish to export your mesh / scene. We chose to export our cube to a folder named cube_model in the same directory in which our project my_scene is located. The exporter then exports the Cube.mesh file corresponding to our cube model to the specified folder.

STEP 3: Add Your Model to the Meta Data File

1 {
2   "name" : "my_scene",
3   "scene" : "",
4   "resources" : ["../cube_model"],
5   "logic"  : "main.js"
6 }

We have to tell PALAIS where to find the .mesh file to have our cube loaded into its environment. To do so we specify the folder to which we exported the cube model in the resources property in our project's meta data file. Note that the directories listed here are evaluated relative to the project meta data file, hence the ../ prefix. If you exported a whole scene you have to enter the location of your .scene file in the scene property.

STEP 4: Using Your Model

1 function onSetup() {
2   Scene.instantiate("myCube", "Cube", new Vector3(0,0,0));
3 }
5 function onTeardown() {
6 }
8 function update(deltaTime) {
9 }

Call Scene.instantiate() in your logic file to dynamically instantiate our cube as a scriptable actor. The first parameter to Scene.instantiate() is the actor's name, the second parameter is the name of our mesh file and the third parameter sets the initial position of the actor. If you exported a whole scene you don't have to do anything on the scripting side. PALAIS will automatically load your scene and all actors in it will be instantiated for you.

With the changes made we can now start up PALAIS. After pressing the play button to start the simulation we can view our cube model in all of its beauty.

If you wish to have your model already loaded before starting the simulation you can call Scene.instantiate() in the global scope of your logic file.