.. _trafficLight: ************ Traffic Light ************ `Youtube tutorial. `_ .. _trafficLightGlobalLightHowToUse: How To Customize City Crossroads ------------ #. Open :ref:`Global Light Settings `. `Spirit604/CityEditor/Window/Global Traffic Light Settings` .. image:: /images/road/trafficLight/GlobalLightConnectionSettingsOpen.png #. Enable :ref:`Show world info `. .. image:: /images/road/trafficLight/GlobalLightViewExample1.png #. You can now quickly view and adjust the timelines of all the crossroads. #. Enable :ref:`Show disabled Lights ` to see crossroads with traffic lights switched off. .. image:: /images/road/trafficLight/GlobalLightViewExample2.png #. Select the desired crossroad and press `Select`. #. In the :ref:`TrafficLightCrossroad ` component, you can now set the timings. How To Assign Light ------------ #. Open :ref:`Global Light Settings `. #. Enable :ref:`Show light connections `. .. image:: /images/road/trafficLight/GlobalLightConnectionSettings.png #. Select :ref:`Light connection type ` for example :ref:`Traffic node `. .. image:: /images/road/trafficLight/GlobalLightViewTrafficNodeConnection.png #. Select :ref:`H0 ` or :ref:`H1 ` depending on the desired light index. #. Next, select the desired :ref:`T ` (:ref:`TrafficNode `). #. Now, the selected :ref:`TrafficNode ` will have the selected :ref:`TrafficLightHandler `. #. In the same way, you can assign :ref:`Light objects ` by changing the :ref:`Light connection type `. .. image:: /images/road/trafficLight/GlobalLightViewLightConnection2.png `Light object connection example.` .. _trafficLightGlobalLight: Global Lights Settings ------------ Window for quick display of crossroad timings and for linking the traffic lights to different entities. How To Use ~~~~~~~~~~~~ Read more :ref:`here `. Settings ~~~~~~~~~~~~ .. image:: /images/road/trafficLight/GlobalLightSettings.png .. _trafficLightGlobalLightCommonSettings: Common Settings ~~~~~~~~~~~~ | **Focus on select** : move the `SceneView` camera to the selected traffic light crossroad when you select. | **Show world info** : show enabled traffic light data in the scene (:ref:`example `). | **Show disabled lights** : show all traffic light data (include disabled) in the scene (:ref:`example `). .. _trafficLightSceneInfo: .. image:: /images/road/trafficLight/GlobalLightViewExample1.png `Scene light info example.` .. _trafficLightSceneInfo2: .. image:: /images/road/trafficLight/GlobalLightViewExample2.png `Scene light info (include disabled) example.` .. _trafficLightGlobalLightObjectDescription: Connection Settings ~~~~~~~~~~~~ .. image:: /images/road/trafficLight/GlobalLightConnectionSettings.png | **Show light connections** : on/off light connections in the scene. | **Auto unselect handler** : auto unselect :ref:`TrafficLightHandler ` when connecting :ref:`TrafficLightHandler ` traffic lights to any object. | **Allow override light index** : allow index traffic light overrides in traffic :ref:`light objects `. | **Reparent light** : traffic :ref:`light object ` will be a child of the connected crossroad. **Light connection type** : * **All** : show all connection types. * **Traffic node** : show :ref:`traffic node ` connection only. * **Light** : show light object connection only. | **Show connection buttons** : show connection buttons for selected `Light connection type`. | **Lights index** : objects with a selected :ref:`light index ` are displayed (-1 value - all indexes are displayed). .. image:: /images/road/trafficLight/GlobalLightViewTrafficNodeConnection2.png `Selected Light connection type : [TrafficNode] and Lights index : [0] example.` World Lights ~~~~~~~~~~~~ | **Custom settings** : on/off custom timeline settings for selected crossroad. **Timeline:** shows :ref:`light states ` of crossroad and total duration. * **TrafficLight [0]** : :ref:`TrafficLightHandler ` with :ref:`light index ` 0. * **TrafficLight [1]** : :ref:`TrafficLightHandler ` with :ref:`light index ` 1. .. _trafficLightGlobalLightObjectDescription: SceneView Light Objects Description ~~~~~~~~~~~~ Select: * H0/H1 : :ref:`TrafficLightHandler ` (index 0, index 1). * T0/T1/T : :ref:`TrafficNode ` (index 0, index 1, no index). * L0/L1/L : :ref:`Light object ` (index 0, index 1, no index). Unselect: * H- : unselect :ref:`TrafficLightHandler `. * T- : unselect :ref:`TrafficNode `. * L- : unselect :ref:`Light object `. .. image:: /images/road/trafficLight/GlobalLightAllConnections.png `All connection types and -1` :ref:`light index ` `are enabled example.` .. _sharedLightStateReplace: How To Replace Global Light States ~~~~~~~~~~~~ #. Open :ref:`Global Light Settings ` window. #. Click the `*` button to expand the `Replace settings`. .. image:: /images/road/trafficLight/replaceShared0.png #. Select the source :ref:`state container ` you wish to replace. .. image:: /images/road/trafficLight/replaceShared1.png #. Select your new desired :ref:`State container `. .. image:: /images/road/trafficLight/replaceShared2.png #. Click the `Replace` button. #. As a result, all the source :ref:`State containers ` are replaced. .. image:: /images/road/trafficLight/replaceShared3.png .. _sharedLightStates: Shared Light State Container ------------ Contains common timings of :ref:`light states ` that are shared between :ref:`traffic light crossroads `. You can easily replace shared containers using the :ref:`Global Light Settings ` tool. How To Create ~~~~~~~~~~~~ from the project context : .. image:: /images/road/trafficLight/sharedLightStatesPath.png Default Container Path ~~~~~~~~~~~~ .. image:: /images/road/trafficLight/sharedLightStatesProjectPath.png `Project path example.` Settings ~~~~~~~~~~~~ .. image:: /images/road/trafficLight/sharedLightStates.png `Example.` .. _trafficLightState: Light States ------------ * Green : car only drives on a green lights. * Red * Yellow * Red Yellow : red and yellow lights at the same time, shown as orange in the inspector. .. _trafficLightIndex: Light Index ------------ Unique traffic light ID in :ref:`TrafficLightCrossroad ` defined in :ref:`TrafficLightHandler ` used to link :ref:`TrafficLightHandlers ` and :ref:`traffic lights ` by index. .. _trafficLightHandler: Traffic Light Handler ---------------- `Traffic Light Handler` is an entity for handling the state of a traffic light. Is part of :ref:`TrafficLightCrossroad `. Settings ~~~~~~~~~~~~ .. image:: /images/road/trafficLight/TrafficLightHandler.png | **Traffic light crossroad** : reference to the :ref:`TrafficLightCrossroad `. | **Triggers** : nodes that relate to the handler. | **Traffic light parent** : parent to which the :ref:`light objects ` will be added. | **Pedestrian light parent** : parent to which the :ref:`light objects ` will be added. | **Related light index** : linked traffic :ref:`light traffic index `. | **Child lights** : list of attached child :ref:`light objects `. | **Custom lights** : list of attached custom :ref:`light objects `. | **Light states** : :ref:`light state of handler `. Components ~~~~~~~~~~~~ Authoring ~~~~~~~~~~~~ .. _trafficLightObject: Traffic Light Object ------------ Main Component ~~~~~~~~~~~~ Traffic light object in the scene (parent component of the traffic light). Contains data on the :ref:`light frames ` and linked :ref:`light indexes `. .. image:: /images/road/trafficLight/TrafficLightObject/TrafficLightObjectComponents.png .. image:: /images/road/trafficLight/TrafficLightObject/TrafficLightObjectExample.png `Traffic light object example.` .. _trafficLightFrame: Light Frame ~~~~~~~~~~~~ A child component that contains the data for the traffic light indicators. .. image:: /images/road/trafficLight/TrafficLightObject/TrafficLightObjectFrameAssignExample.png | **Traffic light object** : reference to :ref:`light frames `. | **Red light** : red light :ref:`state ` entity. | **Yellow light** : yellow light :ref:`state ` entity. | **Green light** : green light :ref:`state ` entity. | **Initial light index** : initial :ref:`light index `. | **Index direction** : direction in which the :ref:`light index ` is displayed in the scene.