.. _trafficNode: Traffic Node ===== `Traffic node is a set of traffic node entities that are connected to other traffic node entities by a` :ref:`path ` .. _trafficNodeSettings: Settings ---------------- Cached ~~~~~~~~~~~~ .. image:: images/road/trafficNode/TrafficNode.png | **Traffic light crossroad** : the :ref:`crossroad ` to which the node belongs. | **Traffic light handler** : traffic light that the traffic node is linked (:ref:`TrafficLightHandler `). Lane Data ~~~~~~~~~~~~ .. image:: images/road/trafficNode/TrafficNode2.png | **Lanes** : :ref:`right side lanes ` (to connect `TrafficNodes` within a :ref:`RoadSegment `). | **External lanes** : :ref:`left side lanes ` (to connect nodes in :ref:`external RoadSegments `) (:ref:`additonal info `). Settings ~~~~~~~~~~~~ .. image:: images/road/trafficNode/TrafficNode3.png | **Lane count** : number of lanes. | **Lane width** : lane width. | **Divider width** : divider line width. | **Chance to spawn** : chance of the vehicle spawning in the node. | **Weight** : weight of the node for route selection by traffic. | **Custom achieve distance** : custom distance to achieve a node (if 0 value default value will be taken). | **Capacity** : capacity of the nodes (used for parking, bus station, etc...). **Light type:** * **Right** : right-hand lanes have traffic lights. * **Left** : left-hand lanes have traffic lights. * **Right and left** : right and left lanes have traffic lights. | **Has crollwalk** : quick on/off crosswalk option for pedestrians. | **Is one way** : all lanes are one-way traffic lanes (:ref:`more info `). | **Is end of one way** : node ends one-way traffic for this :ref:`RoadSegment ` (:ref:`more info `). | **Lock path auto creation** : on/off prevent auto path creation (:ref:`more info `). | **Auto path is created** : auto path is created (:ref:`more info `). Traffic Node Type ~~~~~~~~~~~~ Default ^^^^^^^^^^^^^^^^^^^^^^ Parking ^^^^^^^^^^^^^^^^^^^^^^ Node where cars are :ref:`parked ` (read more :ref:`parking states `). Traffic public stop ^^^^^^^^^^^^^^^^^^^^^^ Node where :ref:`public traffic ` stops to pick up passengers. Destroy vehicle ^^^^^^^^^^^^^^^^^^^^^^ Node where the vehicle entity is destroyed (useful for nodes outside the map). Traffic area ^^^^^^^^^^^^^^^^^^^^^^ :ref:`TrafficArea node `. Idle ^^^^^^^^^^^^^^^^^^^^^^ Node where the vehicle is idling. Trigger ^^^^^^^^^^^^^^^^^^^^^^ Node to notify the user that the entity has reached the node. **How to use:** * Activate `TriggerNodeConfig` & sync with the subscene. .. image:: /images/road/trafficNode/TrafficNodeTrigger1.png * If you need to subscribe to this reach event, use `Traffic Node Service`. .. image:: /images/road/trafficNode/TrafficNodeTrigger2.png If you need to associate a scene object with the trigger event, follow these steps: * Activate `EntityBindingConfig` & sync with the subscene. .. image:: /images/core/entityBindingConfig.png * Create a new game object in the scene where the trigger is expected (e.g. cube). .. image:: /images/road/trafficNode/TrafficNodeTrigger3.png * Add `TriggerNodeHybridListener component`. .. image:: /images/road/trafficNode/TrafficNodeTrigger4.png * Press `+` button in the inspector. .. image:: /images/road/trafficNode/TrafficNodeTrigger5.png * Press `+` on the scene node to which you want to associate the current scene object with the entity. .. image:: /images/road/trafficNode/TrafficNodeTrigger6.png `Source scene example.` .. image:: /images/road/trafficNode/TrafficNodeTrigger7.png `Selected node example.` * Now you can listen to entities arriving on this node by subscribing to ``TriggerNodeHybridListener.OnTriggerEnter`` with code in the `TriggerNodeHybridListener` component or by using `UnityEvent` in the inspector of this component. Trigger And Destroy ^^^^^^^^^^^^^^^^^^^^^^ Node to notify the user that the entity has reached the node & then destroy the entity. Use case is the same as the `Trigger type`. Buttons ~~~~~~~~~~~~ | **Connect** : node will try to :ref:`connect ` to other nodes if no external paths are created yet. | **Force connect** : node will try to :ref:`connect ` to other nodes whether it is :ref:`connected ` now or not (except `Lock path auto creation` option is enabled). | **Resize** : resize :ref:`collider ` of node. .. _trafficNodeOneWay: OneWay Node Info ---------------- Oneway node description example: .. image:: /images/road/trafficNode/OnewayExample.png Node example key features: * **Node 1:** * Is one way **[enabled]** * Source path is in the : **[Lanes]** * External Lanes **[Always empty]** * **Node 2:** * Is one way **[enabled]** * Is end one way **[enabled]** * Source path is in the : **[External Lanes]** * Lanes **[Always empty]** .. _trafficNodeConnectionInfo: Direction Connection Info ---------------- .. _trafficNodeRightDirection: Rightside Lanes ~~~~~~~~~~~~ Rightside lanes (default lanes) connect :ref:`TrafficNodes ` within a :ref:`RoadSegment `. .. image:: /images/road/trafficNode/ConnectionInfoExampleRightSide.png `Rightside lanes example.` .. _trafficNodeLeftDirection: Leftside Lanes ~~~~~~~~~~~~ Leftside lanes (external lanes) connect :ref:`TrafficNodes ` in external :ref:`RoadSegments ` (:ref:`external connection example `). .. image:: /images/road/trafficNode/ConnectionInfoExampleLeftSide.png `Leftside lanes example.` .. _trafficNodeLeftDirectionInfo: .. warning:: Intersecting `External paths` should be replaced by a separate :ref:`segment ` to :ref:`bake the intersection of the paths `. .. _trafficNodeRotation: Node Rotation ~~~~~~~~~~~~ Direction of each :ref:`TrafficNode ` must be opposite to the center of the segment .. image:: /images/road/trafficNode/TrafficNodeDirectionExample.png **Example description:** * The arrow represents the forward rotation of the :ref:`node `. * Purple arrows the direction of the outer :ref:`nodes ` of the :ref:`segment `. * Blue arrows the direction of the internal :ref:`segment ` :ref:`oneway nodes `. .. _autoPathConnection: Auto-path Connection ---------------- * To quickly create connections between :ref:`RoadSegments ` on the same line, the `Auto-Path` connection is used. * If the :ref:`segments ` are not on the same line you should to create another :ref:`Custom straight road segment ` or :ref:`Custom segment ` between them and do the same connection. * You can also manually create paths between :ref:`segments ` using the :ref:`PathCreator tool `. How To Use ~~~~~~~~~~~~ * To activate auto-connection paths for all nodes you can in :ref:`RoadParent ` by pressing `Connect` button. * Each time you create a new :ref:`RoadSegment `, press `Force connect` in :ref:`RoadParent `, then `Bake Path Data` (:ref:`baking info `). .. _trafficNodeCollider: .. note:: * To prevent auto-path connection for the selected :ref:`TrafficNode ` enable **Lock path auto creation** in the :ref:`settings ` of the node. * Each :ref:`TrafficNode ` has a `box collider` whose is size calculated based on the number of lanes, their width, and the type of lanes (:ref:`one-way ` or not). * Make sure that the :ref:`direction of the node ` is set correctly. .. _trafficNodeConnectionExample: .. image:: /images/road/trafficNode/AutopathConnectionExample2.png `Auto path connection example.` CullState Info ---------------- :ref:`States ` ~~~~~~~~~~~~ * **Culled** : entity not available for spawning. * **CloseToCamera** : entity available for spawn. * **InVisionOfCamera** : entity available for spawn only during the initial scene start.