Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.
No language code for this page. You can select other language.
No language code for this page,
shown in other instead.
shown in other instead.
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
To be operated, the child nodes of the switcher should be placed inside the switcher object fully or partially.
Each object at the picture is composed from a switcher and 2 spheres of different color.
- WorldSwitcher class to edit world switchers via UnigineScript
Adding a Switcher
To add a switcher to the scene via UnigineEditor, do the following:
- Run UnigineEditor.
- On the Menu bar, click Create -> World -> Switcher.
- Place the object somewhere in the world.
- Make the object that will be operated the child of the switcher.
- Specify the switcher parameters and the distance of enabling / disabling.
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 Switcher tab you can adjust the following parameters of the switcher:
A Switcher tab
Bounding Box Parameters
A set of bounding box parameters:
|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:
Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)