Search Unity

Simple Traffic System

Discussion in 'Assets and Asset Store' started by Stephen_O, Dec 15, 2019.

  1. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    hey hopefully you have gotten this fixed but our projects seem similar so i figured i would post what fixed mine since i was having same issues

    first i had to down grade burst to to the current supported with this of 1.4.2 and then everything else of dots i brought down to 0.1.1 as its the highest supported of collections (stated on the first page. unsure if this was an issue but was a pain to downgrade and not wanting to upgrade to just repeat again)

    next i had to change car models from layer 30 to default to fix my project structure. i use dk uma so layer 30 is my ragdoll layer and it can only collide with itself.

    the last step is changing all AITrafficWaypoint's layer to something other than default ( has to be a layer you dont have selected on the controller) i use the transparentfx layer.

    hopefully there will be an option to preset the AITrafficWaypoint layer or maybe im not finding it. but after all that it was working.
     
  2. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    well now i need help lol. i have roads set up in my city and got the first intersection working with yields. now im getting this error and idk why

    NullReferenceException: Object reference not set to an instance of an object.
    TurnTheGameOn.SimpleTrafficSystem.AITrafficController.FixedUpdate () (at Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/AITrafficController.cs:704)
     
    Last edited: Jan 22, 2021
  3. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    This error would be caused by the waypoint having an unassigned Yield trigger array index.

    empty yield trigger.jpg

    Have you used the video tutorial for yield triggers? Following the steps in the video will make sure all fields are populated since it automates the reference assignments.

     
  4. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    Thats exactly what I thought it was and have been up 24 hours going through every one and checking. I must have missed one. Thank you
     
  5. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    Where all should I compare to know which ones should have the yield trigger. I did follow the video and had it all working before but then...
     
  6. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    I don't have a built in tool for this, but you can use the Hierarchy search field for AITrafficWaypoint, then select the first one, expand the Yield Triggers array, and press up/down arrow keys to scroll through hierarchy to check them.

    waypoint.jpg

    Perhaps in a future update I will add an integrity checker tool, that can search all STS components for missing references, to make finding them faster.
     
  7. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    Yes sorry for the misunderstanding. I was wondering where it pulls information that there should be a value there? You said it shows that when its not populated. How does it know its suppose to be?
     
  8. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    This video link starts at 5:46 and shows where the references are connected. You need to use STS Tools Yield Trigger menu to select a waypoint and yield trigger, then press Assign Yield Trigger To Waypoint to connect references, which assigns the routes AITrafficWaypointinfo script reference, (explained at 1:50 in video).
     
  9. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    Yes I know this about assigning. Trust me I watched the video a million times trying to solve this on my own. I know how to set it up. I know how to click route, waypoint, and trigger. I know all that. Im asking after the fact where is it pulling from to determine that a yield trigger should be assigned. How does it know? What other values are telling this waypoint should have a yield trigger.
     
  10. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    The routes are waypoint based, the car is always heading toward the next waypoint, when the next waypoint contains a yield trigger reference, and it’s triggered, the car will stop until it’s not triggered anymore. It’s not triggered anymore when the routes light is green, or when it's empty. AITrafficWaypointRouteInfo.yieldForTrafficLight is the bool that the trigger sets, read by the AITrafficController.
     
  11. mitis

    mitis

    Joined:
    May 21, 2013
    Posts:
    52
    Hi, I have a problem, see my asset for some reason is different from what you have in the video tutorial
     
  12. mitis

    mitis

    Joined:
    May 21, 2013
    Posts:
    52
    Why is my instrument so different from yours? What's in your YouTube channel
     
  13. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    All tools were moved to STS Tools window almost a year ago with version 1.0.7, current version is 1.0.44.
     
  14. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    So every waypoint that is suppose to be set with a yield trigger is. So where do I need to check to make sure settings are right so it doesn't give this false alert anymore
     
  15. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    The cars don't even move from their starting position unless I disable the yield feature. No car ever even reaches a position to trigger the yield feature. So please tell me where else I need to check to remove this false error. I havent slept for 48 hours and have went through all the waypoints (which takes a long time to) over 7 times now checking everything. I only have 4 waypoints that have a yield trigger set up because I only set this up with that one intersection. No other waypoint has a yield set up
     
  16. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    The yield triggers are only set on AITrafficWaypoint component, as shown in the image, if an array element says 'None' instead of a reference, then that will cause the error you posted due to a missing reference:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object.
    2. TurnTheGameOn.SimpleTrafficSystem.AITrafficController.FixedUpdate () (at Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/AITrafficController.cs:704)


    I don't think spending 48 hours looking at waypoints is healthy. If you need support, please send me a request with your invoice number, along with the project/scene so I can assist you by having a look to determine where the misconfiguration is.

    stephen@turnthegameon.com
     
  17. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    Here's a tutorial for assigning multiple routes to a single traffic light:

     
  18. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    yes it is very unhealthy and you know how much of a pain find the invoice is even though i see no way it at all it would progress this. and thanks for assuming i am an idiot. as i've stated i have 4 waypoints set up with a route assigned under the yield triggers drop down. those routes have a yield trigger collider setup under the route info on that route. i have watched the video way more times than i should have needed too and the obvious setups i have went through multiple times. i even undone and removed the yield triggers and it still gave the same error. which is why im trying to find out what non public place you have it assigned at so i could write something and fix because i wasnt finding anywhere at all set up with a yield. which should have just ended badly on the streets not no car leaving their spawn point. i am finally almost done preparing you a stripped down project from when you asked for it. and then im going to take a small nap and give this one more day before i just remove it because i have been asking the same question over and over and im getting tired of watching your videos due to this. i was loving your system and found it easy to use until this happened.
     
  19. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    It's not my intention to offend you, only to resolve the issue, which is why I asked for a reproduction for me to debug. I ask anyone who requires email support for an invoice number as standard practice.

    Thank you for providing me a reproduction scene. I was able to debug the error, and send you a fix.

    It seems you've found a case where the current waypoints onReachWaypointSettings.nextPointInRoute is null during the yield trigger check.

    I've added a null check to prevent this error, please import the attached package to resolve the error. This fix will be added to the next update, version 1.0.45.
     
  20. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    Version 1.0.45 submitted.

    • Added CiDy 2 integration, requires CiDy 2.7 or higher.
    • Added Scripting Define 'SimpleTrafficSystem' for 3rd party asset integrations.
    • AITrafficWaypointRoute.SetupRandomSpawnPoints no longer spawns the final 3 points of a route.
    • STS Tools - Spawn Points Menu - SetupRandomSpawnPoints no longer spawns the final 3 points of a route.- Adjusted wheel collider values to be more stable.
    • AITrafficController now spawns with a random traffic car prefab assigned by default.
    • Improved various movement and physics related settings for AITrafficCars to allow for accelerating faster, and better handling at higher speeds.
    • Updated Stylized Vehicle Pack prefabs with improved car settings.
    • Fixed AITrafficWaypointRoute.DrawGizmos when it would not draw gizmos for short routes.
    • Fixed a bug where using yield triggers would sometimes cause an error.



     
  21. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    Version 1.0.46 submitted.

    • Added new option, AITrafficController.frontSensorFacesTarget, Rotates the front sensor to face the next waypoint.
    • Fixed a bug where CiDy multi lane road traffic lights were not properly setup.
    • Fixed a bug where faster cars would not always stop at an intersection for a red light.
    • Improved the stop position of cars approaching an intersection red light, specifically for CiDy 2 generated waypoints.

    AITrafficController - Front Sensor Faces Target Example:
    SensorsFaceNextWaypoint.gif
     
  22. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    Version 1.0.46 is now available.
     
  23. ZolnierGames

    ZolnierGames

    Joined:
    Feb 19, 2018
    Posts:
    88
    So, how do I change the TrafficController pool density at runtime? Thanks!
     
  24. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    Make a reference to it and set the new density:

    Code (CSharp):
    1. using TurnTheGameOn.SimpleTrafficSystem;
    Code (CSharp):
    1. AITrafficController controller = FindObjectOfType<AITrafficController>();
    2. controller.density = 20;
     
  25. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    Version 1.0.47 submitted.
    • The final waypoint gizmo will be red if a new route point array size is 0, or an element is empty.
    • Selecting a route, will now show green connection lines.

    Waypoint Gizmos.gif
     
    Bartolomeus755 likes this.
  26. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    1.0.48 submitted.

    • Improved end of route waypoint gizmo and new route point gizmo line coloring to better visualize new connections without anything selected, specifically at intersections. Colors can be changed in preferences window.

    NewRoutePointJunctionGizmos.jpg
     
    Bartolomeus755 likes this.
  27. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    Version 1.0.48 resubmitted with some additional changes:

    • Fixed a bug where startup traffic could spawn more cars then density.
    • Added AITrafficController.carsInPool value to control amount of cars that will be instantiated at scene start; detaches startup spawn amount from density, allows increasing density at runtime, up to carsInPool value, without requiring runtime instantiate.
    • Added option to set first point color in Preferences menu.
    • Improved end of route waypoint gizmo and new route point gizmo line coloring to better visualize new connections without anything selected, specifically at intersections.
     
  28. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Pre buy question:

    Looking to bring some life to a project.
    This looks amazing.

    1: Can i replace the cars with my own models?
    We already have a ton of different models, including trucks (not semi, but like garbage truck, just a big car.)

    2: Any one had any experience adding pedestrians assets to this?
    Just need people walking around, similar to the cars, not doing anything but look good. :D
     
  29. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510

    Hello, yes you can use your own models, I just created an updated traffic car setup video:



    Wizards Code was working on an open source pedestrian system that you can find on GitHub:

     
    Vaupell likes this.
  30. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    Version 1.0.49 submitted.

    • Fixed a bug where AITrafficSpawnPoint OnBecameVisible callbacks were being triggered by the scene camera, which caused inconstancies with pooling spawning while scene camera is visible.
     
  31. steve_mmsoft

    steve_mmsoft

    Joined:
    Apr 29, 2020
    Posts:
    4
    For some reason, cars are spawning/appearing underground and falling forever.
    upload_2021-2-12_15-48-5.png
    You will note that they have no wheels, although I promise that the wheel colliders are still there.

    This is just from running the demo scene and waiting a couple of seconds in unity 2019.3.7f1.

    These cars don't seem to despawn - they're still inside the horizontal radius of the center, despite being 5000 metres beneath zero.

    None of my game is beneath zero, so I'm thinking there might be a hack fix of despawning the car if it is beneath, say, -100. However, this wouldn't work for other people's games where they do go below zero.

    Have you seen anything like it before? Do you have any suggestions?
     

    Attached Files:

  32. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Trying to follow there video guide you put up with Cidy2 intergration..

    I get a warning to "
    ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

    Error:
    Code (csharp):
    1.  
    2. ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    3. Parameter name: index
    4. System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <9577ac7a62ef43179789031239ba8798>:0)
    5. System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <9577ac7a62ef43179789031239ba8798>:0)
    6.  
     
    Last edited: Feb 12, 2021
  33. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    This is an editor only bug, that occurs when the scene view is docked over the game view. This will never happen in a build.

    Since the game view is hidden, the scene view camera is the only available camera, ignoring the game view camera.

    When the cars are returned to the pool, they are sent to that position (0, -2000, 0), then the gameobject is disabled.

    CAE424B2-E255-4308-A5CD-86979EF6F780.gif

    The cars use the OnBecameInvisible callback, as the final check, to determine if they should go to the pool, this prevents cars from returning to the pool if the camera can still see them while they're in range.

    https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnBecameInvisible.html

    Since the cars are being seen by the only active camera in this editor state, it is causing them to stay visible and active.

    The only way to avoid it is to make sure the game view is always visible, so that the scene view is not used as a fallback camera.
     
  34. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    That's odd, there's no specific information about the source of that error that I can provide feedback for.

    I just did a test with the following steps and everything worked without any errors:

    1. new 2019.4.20 LTS project
    2. import cidy 2.7.2
    3. import sts 1.0.49 (install packages)
    4. tools > simple traffic system > sts tools window (import cidy 2 integration package)
    5. window > cidy > cidy editor (create scene graph)
    6. create terrain
    7. create city nodes
    8. set sts tools window configure mode to cidy 2 (generate)
    9. spawn AITrafficController from sts tools window
    10. press play (simulation runs)
     
    Vaupell likes this.
  35. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    Version 1.0.50 submitted.

    • Fixed a bug where vehicle types would not always take the correct route unless it was the final point of a route.
     
  36. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Hi, i added a single car to the system to test..

    Where do you adjust their braking., because i see them attempt to brake, but they still hit the car infront and bumbs back, also with alot of traffic they driver "litteraly" bumper to bumper :D Funny but not intended :D

    I did match the "sensor" placements as shown in the example cars.
    upload_2021-2-13_15-5-16.png

    upload_2021-2-13_15-6-38.png
    Other than the close driving, it seems to be working just fine..

    The only vehicle that stops in good time is the truck :p

    upload_2021-2-13_15-16-32.png


    EDIT: I fixed it, i forgot to assign the vehicles and AITrafficController the right layer..
    So i created a layer called "Vehicles" added to all the AI vehicles and the controller., Viola.. IT WORKS :D

    upload_2021-2-13_16-13-17.png
     
    Last edited: Feb 13, 2021
    Stephen_O likes this.
  37. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    I'm glad you were able to get the new cars to work properly :)
     
  38. steve_mmsoft

    steve_mmsoft

    Joined:
    Apr 29, 2020
    Posts:
    4
    Thanks very much - I was starting to think I was going crazy :)
     
  39. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Playing with the CiDy2 intergration, and found a issue.
    If i change one of the CiDy2 roads to use stop signs instead of lights, or if i change one of the roads STS cannot regnerate anymore.

    Found when
    - Changing a road from traffic light to stopsigns
    - Changing number of lanes on a road.

    I tried deleting all STS in scene, but even if i clear, it "still" remembers something and error continues.
    So basically "you get 1 chance" to use STS with CiDy2, and no changes can be done after, unless you do it manually.

    The null reference errors, just links to a different AITrafficLightManager_XX each time, i currently have 74 in scene.
    My guess would be to just delete the gameobject, because the Gameobject "taffic light" is now missing because it's gone (changed to stop sign) ;)

    upload_2021-2-15_23-11-44.png

    2 different errors show up

    Error 1: When changing a road size,. (this i cant fix) it happens when i hit "generate" to "update" after road changes with Cidy2
    Code (csharp):
    1.  
    2. ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    3. Parameter name: index
    4. System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <9577ac7a62ef43179789031239ba8798>:0)
    5. System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <9577ac7a62ef43179789031239ba8798>:0)
    6. CiDy.CiDyGraph.CalculateLaneIntersection (CiDy.CiDyGraph graph, System.Int32 laneCount, System.Int32 r, CiDy.CiDyNode node, CiDy.CiDyRoad testRoad, System.Collections.Generic.List`1[CiDy.CiDyRoad]& connectedRoads, System.Collections.Generic.List`1[CiDy.CiDyRoute]& interRoutes, System.Int32 sequenceId, System.Int32 routeId) (at Assets/CiDy/CiDyAssets/CiDyScripts/CiDyGraph.cs:10684)
    7. CiDy.CiDyGraph.BuildTrafficData () (at Assets/CiDy/CiDyAssets/CiDyScripts/CiDyGraph.cs:9140)
    8. TurnTheGameOn.SimpleTrafficSystem.CiDy_STS_GeneratedContent.Generate () (at Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/Integration/CiDy_STS_GeneratedContent.cs:133)
    9. TurnTheGameOn.SimpleTrafficSystem.CiDy_STS_Generator.Generate () (at Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/Integration/CiDy_STS_Generator.cs:24)
    10. TurnTheGameOn.SimpleTrafficSystem.Editor_STSWindow.OnGUI () (at Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/Editor/Editor_STSWindow.cs:1118)
    11. UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <433cbae83977409887e43d50043210d2>:0)
    12. UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <433cbae83977409887e43d50043210d2>:0)
    13. UnityEditor.DockArea.OldOnGUI () (at <433cbae83977409887e43d50043210d2>:0)
    14. UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <dfc77513ee31474e91aa78f02ce15977>:0)
    15. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <dfc77513ee31474e91aa78f02ce15977>:0)
    16. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <dfc77513ee31474e91aa78f02ce15977>:0)
    17. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <dfc77513ee31474e91aa78f02ce15977>:0)
    18. UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <dfc77513ee31474e91aa78f02ce15977>:0)
    19. UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <dfc77513ee31474e91aa78f02ce15977>:0)
    20. UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <dfc77513ee31474e91aa78f02ce15977>:0)
    21. UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at
    22.  
    I suspect the "CIDy_STS_GeneratedContent" is not updated correctly.
    I found several "empty" intersections..
    Example..
    upload_2021-2-15_23-21-53.png


    Error 2: Happens when changing from traffic light to stop sign.
    Code (csharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. TurnTheGameOn.SimpleTrafficSystem.AITrafficLightManager.EnableRedLights () (at Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/AITrafficLightManager.cs:32)
    4. TurnTheGameOn.SimpleTrafficSystem.AITrafficLightManager.Start () (at Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/AITrafficLightManager.cs:16)
    5.  
    This i just fix by removing the gameobject..
     
    Last edited: Feb 15, 2021
    Stephen_O likes this.
  40. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    Thank you for the testing and details of how I can reproduce this bug.

    Currently STS will only generate and configure traffic lights, not stop signs. Using a stop sign, or changing amount of lanes should not cause an error. I'll make sure to do some testing to figure out where CIDy_STS_GeneratedContent is getting stuck and resolve this bug. I can also work with CiDy developer to get STS stop signs loaded, so you'll be able to do lights or stop signs (but they don't work together, so an intersection will need to have one or the other once we get it setup).
     
  41. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    I'm unable to reproduce this error using CiDy 2.7.2 and STS 1.0.50.

    The only error I get is from CiDy about a null serialized property which I think is harmless.

    The routes seem to generate and clear properly when adding or removing lanes.

    CiDy_LaneType.gif
     
    Vaupell likes this.
  42. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    When i get home, i will try a blank scene and see if i can trigger it.
    If i find it, i will record it for you. ;)
     
    Stephen_O likes this.
  43. vanyfilatov

    vanyfilatov

    Joined:
    Dec 2, 2020
    Posts:
    33
    Hi!
    Is there a chance to make the cars in hdrp projects move? Cars appear, but they don't go anywhere. So far, it's difficult for me to fix this myself.
     
  44. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    63
    Hey, I'm not sure if you have any plans for multiplayer/networking with STS, but thought I'd ask?

    It's possibly something I could integrate myself if you don't have plans. I'm thinking it would need to spawn traffic for multiple players who are positioned at different points in the map, and then sync those vehicles over the network.
     
  45. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    I just did a new project test with Unity 2019.4.20, import STS, upgrade materials, and the demo scenes do have moving cars. There are some misc errors due to me calling Camera.current.name == "SceneCamera" in a couple scripts that I can look into. and it looks like emission needs some adjustments. Other than those issues, the cars do move as intended. I will work on setting up a proper HDRP demo to resolve these issues.

    HDRP.gif

    You can check the layer mask on AITrafficController to make sure it’s only detecting your traffic car layer (layer 30 by default). It could be that there are other objects in your scene that are on the same layer and detected by the car sensors, causing them to stop.
     
    Last edited: Feb 16, 2021
    Bartolomeus755 likes this.
  46. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    I don't currently have plans for networking. If I were to set it up, I would have a single simulation that's sync'd for all players.

    I believe there were 2 users that setup their own networked implementation, one named 'Jacksparrow lips' shared some insight on the discord STS channel. It might be helpful for you to inquire with that users to see if some details could be shared.
     
    Guacamolay likes this.
  47. vanyfilatov

    vanyfilatov

    Joined:
    Dec 2, 2020
    Posts:
    33
    It works in a new project, yes. With some materials modifications.
    But in this broken project, layer 30 was occupied when importing the package, now the occupied layer has become 31, and 30 is called FlangeCollider, and the cars are standing and not going anywhere.
    Layer Mask is FlangeCollider in AITrafficController.
     
  48. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,510
    You need to determine what layer you want to use for traffic cars, and update the prefabs to use that layer, then set the AITrafficController Layer Mask to only detect that layer.
     
  49. vanyfilatov

    vanyfilatov

    Joined:
    Dec 2, 2020
    Posts:
    33
    :) car prefabs moved to another layer on package importing
    When I changed their layer to FlangeCollider everything worked fine
    ths for help
     

    Attached Files:

    • sps.JPG
      sps.JPG
      File size:
      79 KB
      Views:
      306
    Stephen_O likes this.
  50. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    63
    Awesome, I'll check it out, thanks for the quick reply!