7.3 How to Design a Fast2D Simulation
Webots' scene tree allows a large choice of 3D objects to be assembled in complex 3D worlds. Because Fast2D is designed to run simulations exclusively in 2D, the 3D worlds must be simplified before the Fast2D simulation can handle them properly.
7.3.1 3D to 2D
The most important simplification is to remove one dimension from the 3D worlds; this is carried out by Webots automatically. In 3D mode, the xz-plane is traditionally used to represent the ground, while the positive y-axis represents the "up" direction. In Fast2D mode Webots projects 3D objects onto the xz-plane simply by removing the y-dimension. Therefore, Fast2D mode ignores the y-axis and carries out simulations in the xz-plane exclusively. However, the naming convention in Fast2D changes, using the y-axis to represent the 3D z-axis. See table 7.1.
| 3D | -> | Fast2D |
| x | -> | x |
| y | -> | none |
| z | -> | y |
| α (rotation angle) | -> | -α (orientation angle) |
Table 7.1: Conversion from 3D to Fast2D coordinate systems.
In short, the 3D y-axis does not matter with Fast2D. The objects' heights and elevations are ignored, and the worlds intended for Fast2D simulation must be designed with this in mind. Furthermore, Fast2D worlds must be designed such that the y-axes of all its Solid and DifferentialWheels nodes are aligned with the world's y-axis. In other words, the rotation field of Solid and DifferentialWheels nodes must be:
Solid { |
This leaves the rotation angle alpha as the only parameter that you can tune. If a Fast2D world does not fulfill this requirement, the result of the simulation is undefined. Note also that Fast2D rotation angles are equal to the negative of the 3D rotation angles. See table 7.1.
7.3.2 Scene Tree Simplification
In Fast2D mode, Webots takes only the top level objects of the scene tree into account. Each Solid or DifferentialWheels node defined at the root level will be used in the Fast2D simulation, but other Solid or DifferentialWheels nodes will be ignored. It is possible to use a Solid as a child of another Solid or as a child of a DifferentialWheels node, but be aware that in this case, although the child Solid does appear graphically, it is not taken into account by the simulation.
7.3.3 Bounding Objects
In Fast2D, just as in 3D simulation, only bounding objects are used in collision detection. Although Webots allows a full choice of bounding objects, in Fast2D mode, it is only possible to use a single Cylinder or a single Box as a bounding object. Furthermore, Fast2D mode requires that the coordinate systems of an object and of its corresponding bounding object must be the same. In other words, any Transform of the bounding object will be ignored in Fast2D mode.