IrrAdventure - Part 3 - Mechanisms creation

Back to the index

Now it begins to be complicated ... You must have remarked that there are written on the console (the black window, or the terminal if you are on Linux), inscriptions about the current node, like :

node=0 north=1 east=0 south=0 west=0

We will use this console for more complicated things.

Data recovery permitting you to create a mechanim

Launch the game. Click with the right button on an object. For example, if you modeled a book, click with the right button on this book. You see on the console something like that :

node=0 direction=4 (clickX="0.986867" clickY="-0.141342" clickZ="0.078208")

This is the coordinates of the point you clicked. Press now Q key. You see :

CRITICAL ERROR : No problem, just quit :-)
Appuyez sur une touche pour continuer...

Before pressing a key, select and copy the line created by the right click.

To do it, if you are on Windows, click right on the window, "Select", and then select the line, like that :

Image de la console

then press Enter

If you are on Linux, you should have launched the game from a terminal. You should just have to select the text and click on it.

Mechanism creation

Paste the text in a text editor, and cut it to keep just the most important :

clickX="0.986867" clickY="-0.141342" clickZ="0.078208"

Insert it in the XML code, between the markers of the node where you were when you clicked :

<node0 north="1">
<mechanism clickX="-0.948778" clickY="-0.218659" clickZ="-0.228055" clickRadius="0.05" newNode="45">
</mechanism>
</node>
<node1 south="0">
</node>
<node45 south="0">
</node>
</nodes>

clickRadius defines the radius of the place where we will be able to click. 0.05 is the default value, but, if the object is big, you must a bigger number.

newNode is the node to where you will be moved if you click on the mechanism (the object). If you don't set this attribute, you will stay at the same node when you click on the mechanism.

For this example, you must create the node 45, which will be a node just in front of the object on which you clicked.

Test

Launch the game. When you click on the mechanism with the left button, you should see in the console :

--click on mechanism (sound=0) and goto node 45--

Go to part 4