Each of the 9 shapes is made with an OrderedGroup containing a (upper) TouchSensor with a Transform2D, to position/rotate etc the Shape within the row, and it contains the Shape and another (lower) TouchSensor. In total then there are 18 TouchSensors for the Shapes - 9 'upper' and 9 'lower'. The upper and lower TouchSensors can be enabled using the check boxes in the upper left of the screen. All 9 are enabled or disabled simultaneously (there is no control for each individual shape).
The hitPoint_changed, hitTexCoord_changed and hitNormal_changed outputs from each TouchSensor are routed via Valuators to convert the values to strings so they can be displayed in Text nodes at the top of the screen. The isOver and isActive outputs are routed to conditionals which, when the outputs are TRUE, set the activated shapes color into the rectangular indicators (to the right of the touchsensors' check boxes) and back to black when FALSE. The lower pair of indicators are for the lower TouchSensors, the upper pair for the upper TouchSensors. So the outputs of the sensors can thus be visualized as the mouse is moved, clicked and dragged etc over the shapes.
Initially the shapes are all Rectangles of 100x80. When the lower TouchSensor for any shape is activated the hitPoint values should range from -50 to +50 for X and -40 to +40 for Y. The shapes local coordinate systems are scaled, rotated, translated etc. so the local X and Y origin and direction relative to the screen can differ between shapes. The center shape however is at 0,0, no rotation etc. The middle row have only translation and scale values set. The upper row includes rotationAngle and center; and the lower row includes scaleOrientation. The shapes in each row have a combination of the fields in the Transform2D, but not necessarily all those stated above are used for each shape in the row. The only one in fact with all fields set in its Transform2D is the one on the lower right. Note: the lower left shape is rotated enough such that it is inverted. This is hard to see with the uniform color and so a texture can be applied by selecting the check box on the lower left of the screen. This allows a texture to be turned on or off for all shapes as desired. The shapes can also be changed by selecting the small geometries along the bottom. Note that for Bitmap, since rotation etc is not supported, only the middle three having translation and scale are used when Bitmap is selected. Also the Bitmap has no geometry without a texture to define it so in this case to get/see the shapes the texture should be turned on.
Sensors are activated according to the lowest enabled in the tree above the shape being touched. As described above initially the lower sensors are enabled. If the lower sensors are disabled then the upper sensors are the ones which will be activated (assuming they are enabled still of course). Here the hitPoint values for the local coordinate systems for the three rows are parallel to sides of the screen with X being 0 in the center of each row (positive values to the right), and Y being 0 in the center of each row, (positive values upwards). When both sensors are disabled then no detection of the shapes can take place.
Snapshot taken with mouse over center red rectangle
![]() |
Snapshot taken after mouse clicked on right side bitmap, and held down and moved off the shape
![]() |