The 2D area input item allows to user to move a cursor within a rectangular or quadratic area
and thereby select two input values at the same time.
For example, this input item can be used to model a steering stick or joystick.
The area input works for three different types: boolean, int, and double.
The following picture shows the simulation view of the area input item for each type.
During the simulation the black circular cursor can be moved by dragging the mouse across the input area.
Double-clicking in one of the grid areas makes the cursor jump to the minimum, center, and maximum value of the area input.
For example, the center grid of the int type item makes the cursor jump to the (0,0) location, while the upper-right grid makes it jump to the (100, 100) location.
For the boolean type item the exact location of the cursor is not relevant, only the grid is evaluated and interpreted as one of the
three possible port values: false, NoVal, or true.
For the int and double type item the exact position of the cursor is interpreted with the respective interval (-100 to 100, or 0.0 to 1.0).
The following picture shows the property section of the area input item:
In the type field the item type is specified. Enter boolean, int, or double here.
In the output field the port values are assigned by using the user input stored in the _this_X and _this_Y variables.
Here, you can scale the input to the values required by the application or you can use the raw value and add another component to your system, which does the scaling.
Note that the display of the area input will always show the values depicted above, not the values you compute for output ports.
Therefore, the second option is possibly the more intuitive one, since the user will see his entered values directly on the output channels.
The following picture is showing the example scene during the simulation:
The scene shows the following objects from the Camera1 perspective:
The scene contains two cameras: the static Camera1 (looking at the origin from a small distance along the positive Y axis) and the moving Camera2 (looking a the origin from a small distance along the X axis and pitching from -20 to 20 degree below and above the X-Y-plane).
The whole animation is driven by a counter component, which counts from zero to 360 and back to zero.
From this input value all object positions are derived using rotation object nodes (see below).
The following picture shows the scene editor of the example.
You can drag objects and display nodes from the library view to scene editor tree.
Note that you have to drop Cubes and Spheres onto the 3D Viewer tree entry, not the loaded objects entry.
You can replace the cube or sphere objects with arbitrary meshes from 3D modeling tools (like Blender) as described below.
The whole scene uses a world coordinate system with the positive Z axis being the upward direction of cameras.
In other words the X-Y-plane is the surface of the scene world.
Camera perspective is fixed to a 45 degree field of view with the near distance set to 0.5 and the far distance set to 400.0.
Each scene needs a least one camera, which means that the scene graph must contain at least one Camera Node.
Cameras are defined by specifying an eye position and a look target location, which may not be the same (i.e. they define a vector).
If you want the camera to be translated and/or rotated, you should set either the eye or the target location to the origin and the other one unit away in either X or Y direction.
See Camera0 in the example for moving camera with fixed target location.
The scene viewer can be used with or without using the OpenGL light engine.
You can switch the use of light using the property section of the 3D Viewer tree item.
There you can also set the ambient light intensity when the light is turned on.
If the light is turned off, the ambient component of the material of loaded objects will be used as color (see next section).
A light source can be specified by adding a Light Node to the scene graph. There is a maximum of 8 lights currently supported.
With the property section you can specify the properties of the light source, in particular, its ambient, diffuse, and specular intensities/colors as well as the attenuation coefficients.
Note that lights can also be positioned in the scene by using transformations (see below).
Each loaded object is instantiated in the scene graph by adding Object Nodes.
The property section of the object node references a loaded object by name.
Note that loaded objects can be used by multiple object nodes with each node possibly being transformed differently.
For example, the white cube is used five times in the tutorial model.
The following picture shows the rotation node properties for the blue sphere (the rotation angle is taken from the input port angle):
The property sections of translations and scalings work similar.
The X, Y, and Z values can also be computed from input port values.
When using Blender to produce the objects to be shown in the 3D Viewer make sure you trianlges and all the normal vectors point in the right direction.
Here is an example picture from the default cube with normals pointing outward.
Before you can import your mesh in the 3D viewer, you must export it from Blender into the Wavefront format (.OBJ object and .MTL material files).
Make sure the edges, normals and materials are exported and the mesh has triangulated faces (if you haven't done so during editing).
Here is an example of the export options that were tested for AF3.
You are advised to export your mesh with correct up axis.