для этой страницы,
отображается код на другом
A switcher is an object that disables or enables its child nodes at the specified distance to the camera. Possible use cases can be the following:
- Enabling one object and disabling another at the specified distance
- Disabling an object while moving away
- Enabling an object while approaching
- WorldSwitcher class to manage world switchers via API
Adding a Switcher#
To add a switcher to the scene via UnigineEditor, do the following:
Switching between Two Objects#
To switch between two object at the specified distance (like shown at the picture above), do the following:
- Create a node dummy for convenient grouping.
- Make the first switcher the child of the node dummy.
- Make the first object the child of the first switcher and specify its maximum visibility distance.
- Make the second switcher the child of the node dummy.
- Make the second object the child of the second switcher and specify its minimum visibility distance.
For objects to be switched at the same point, the maximum visibility distance of the first and minimum visibility distance of the second should match.
In the World Switcher tab of the Parameters window you can adjust the following parameters of the switcher:
Bounding Box Parameters#
A set of bounding box parameters:
|Edit Size||Toggles the editing mode for the world trigger node on and off. When enabled, the bounding box sides that can be resized are highlighted with the colored rectangles. To change the size of a side, drag the corresponding rectangle.
|Point||A flag, indicating if the distance to the object is counted from the center of the bounding box (if disabled, the distance will be counted from its nearest edge).|
|Size||The size of the switcher's bounding box along the X, Y and Z axes, in units.|
|Offset||The offset of the switcher's bounding box along the X, Y and Z axes, in units.|
Switching of distances: