The object is intended for measuring distance on the stage. The ruler can be used independently of other objects, but its functionality will not be great. We will consider how to use it correctly in the example, and now let's pay attention to the object properties

Properties

InspectorLink to Inspector

RulerLink to Ruler

  • Distance (m) - indication of the ruler length
  • Width (m) - specifying the width of the ruler
  • Additional rotation (deg) - rotation of the ruler around the Z axis.
  • Divisions per metre
  • Divisions width (m)
  •  Scale - from which side the ruler starts counting, from right to left or from left to right.
  • Is text vertical - Enable vertical text display
  • Foreground color
  • Background color

BlocklyLink to Blockly

No blocks as such are defined for the ‘Ruler’ object, only a variable denoting the ruler on the stage

Example

To unlock the full potential of the ruler, do the following:

  1. Place the ruler on the stage
  2. Place two points in the ruler as children. The first point is the start of the ruler, the second is the end of the ruler
  3. Set the coordinates for the first point X:0 Y:0 Z:0
  4. Move the second point to any position and you will see that the ruler stretches between the points 
  5. Now let's place inside each of the points one object between which we want to measure the distance. In our case, these will be cubes
  6. For each cube we set the position 0 on each axis. We get the following result
  7. As you can see, the ruler starts counting from the centre of the cube, not from its edge. This happens because the edges of the ruler are bound to the object's pivot and if the object's pivot is in its centre, the ruler will also come from the centre of the object. Consequently, it is necessary to set the position of the cubes so that their inner edges (between which the ruler is located) are in the same plane with the parent points. For this purpose it is necessary to know either the dimensions of the object or to move it by an approximate distance. Since we know the dimensions of the cube, 1x1x1, we need to move the cubes from the parent points to half of its width, that is, 0.5 away from the ruler. We move the first cube to the left, the second cube to the right

In this way you can measure the distance between any of the objects