Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[RELEASED] iTS - Intelligent Traffic System

Discussion in 'Assets and Asset Store' started by rhodnius, Dec 11, 2014.

  1. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    420
    I didn't yet update, is this player layer adjustable? I mean, can it use the 6th layer with a dropdown or some option instead of creating a new layer called Player?
     
  2. TonismoGames

    TonismoGames

    Joined:
    Jun 12, 2018
    Posts:
    109
    Okay thank you for quick reply. I will try to do this. I hope it becomes a feature in the future as it will save a whole lot of work load.
     
    rhodnius likes this.
  3. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    122
    Can you provide a downloadable version of the WebGL Demo? It throws an exception while loading
     
  4. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    Yes you can select it for sure :)

    Thanks for reporting this, would take a look at it and update it

    Sorry for the late reply, didn't received any emails, must have been got directly to spam :confused:
     
  5. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    122
    Thanks, it's probably because my laptop is garbage but I can run EXEs alright
     
  6. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    I'm putting a new demo scene into the asset with better visuals, should be done this week, sorry for having you waiting.

    Also an update that I'm working in a new feature that would do auto connect of your lanes (in case you are creating the road network manually) so you create all your lanes, and then you just set the max distance a lane could be from another to connect and the max angle between their directions (to avoid connecting lanes that are in opposite directions) and then hit auto connect and it would generate the lane connections for you, depending on how complex is your road network, you may need to do a few cleanups, but are way less than having to hand connect all the lanes :D. It would be released as a preview feature in the next release which should be in a few days.
     
    TonismoGames and closetgeekshow like this.
  7. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    Here is a link to a win64 build i just made, let me know if you have any questions :)

    Demo Link
     
  8. unity_V1WlANEebEQloQ

    unity_V1WlANEebEQloQ

    Joined:
    Jul 1, 2019
    Posts:
    6
    Hi,
    I am having a problem with ITS,
    When I import ITS,RCC audio changes I have checked the vfx setting but could not find any.
     
  9. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    Sounds like a project setting might be overriding settings of RCC package, try importing first iTS and then RCC so RCC settings prevail over iTS ones
     
  10. unity_V1WlANEebEQloQ

    unity_V1WlANEebEQloQ

    Joined:
    Jul 1, 2019
    Posts:
    6
    I have done this but it still causing the same problem.
     
  11. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    hmm weird, as iTS does not do anything to project files at all, however it is a complete project asset which the Asset store packaging tool includes the project settings for (not something I can control) so maybe you are getting some setting overridden, you could import RCC into an empty project and compare the settings on it with the one that you have both iTS and RCC and see what have changed
     
  12. unity_V1WlANEebEQloQ

    unity_V1WlANEebEQloQ

    Joined:
    Jul 1, 2019
    Posts:
    6
    Okay. Thanks alot for help.
     
  13. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    Sure let me know how it goes, you can also try not importing the project settings from iTS, but it could lead to you needing to add tags and layers manually for it to work
     
  14. udaypeddinti

    udaypeddinti

    Joined:
    Jun 23, 2021
    Posts:
    4
    hi , this is uday ,i would like to create traffic simulation for real city , will it be possible to create 2 groups of vehicals which are differenet in their average speed . so that overtaking takesplace and also public transport like busses to stop at halt stations
     
  15. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    Hello @udaypeddinti

    Sure you can set different car prefabs with different parameters to each so you could have the behavior you are looking for.

    For the public transport to do stops, you would need to do it separately, i think simple trigger and script listening to on trigger enter would work wonders to make the bus stop at specific points by applying brakes directly with this script for an specific or random amount of time to simulate the stops.
     
  16. rchia013

    rchia013

    Joined:
    Aug 20, 2020
    Posts:
    7
    Hi there!
    May I ask how do I link the traffic light to the lanes that I have created for the cars?
     
  17. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    Sure, you just add the traffic light and move it close to the lane you want, then on the inspector you would see the option to add lane points, and you can click on the lane points you want to add on the scene view.
     
  18. NathanNegreiroMyPad3D

    NathanNegreiroMyPad3D

    Joined:
    May 10, 2018
    Posts:
    7
    Hi, I've started to use iTS for my project, but have been running into a few issues. The cars seem to behave oddly at times; they'll collide in intersections, and then get stuck, following with more cars coming up behind and filling the intersection. I have several parked cars the side of the road, sometimes the iTS cars will merge into the adjacent lane to drive around them, somtimes they'll just stop behind them indefinitely, and sometimes they'll try to overtake them, but just stop, blocking both lanes.

    I've tried to mess with some of the AI settings, but nothing I do has any effect. I've been using the cars provided in the example project for this. I imagine that there's a way to resolve these issues, but I can't figure out what it would be.
     
  19. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    Thanks for using iTS!

    would be great if you could share some screenshots of settings you have, the lanes on the scene view to be able to tell what could be going on

    Also you can join our Discord Server, support there is way faster than here since it is a DM app.

    Discord link down here ▾
     
  20. TonismoGames

    TonismoGames

    Joined:
    Jun 12, 2018
    Posts:
    109
    @rhodnius Hello friend, I created the lanes using the API provided and I ended up with this zig zap line mess. The points are correct but the spline isnt showing correctly. Any idea on how to fix this?
    upload_2023-4-11_16-48-50.png
    NVM I fixed it by changing AddLane tolerance to 0. What does tolerance mean when adding lanes?
     
    Last edited: Apr 11, 2023
  21. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    from the screenshot, it might be that you have less middle points far from those 3, and when the interpolation takes place that could happen, try to evenly place middle points along the lane.
     
  22. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    I just saw this, tolerance is for the spline creation/simplification, would have to take a look at it to be 100% sure
     
  23. TonismoGames

    TonismoGames

    Joined:
    Jun 12, 2018
    Posts:
    109
    Code (CSharp):
    1.       public void AddTraffic()
    2.         {
    3.             tsMaingManger.Clear();
    4.             // Loop through each segment and add it to the spline
    5.             for (int j = 1; j <= lanes; j++)
    6.             {
    7.                 List<Vector3> lanePoints = new List<Vector3>();
    8.                 List<Vector3> reversePoints = new List<Vector3>();
    9.                 for (int i = 0; i < childrenSegments.Count; i++)
    10.                 {
    11.                     // Get the current segment and its offset from the center
    12.                     Transform segment = childrenSegments[i];
    13.  
    14.                     // Initialize the starting point of the spline
    15.                     Vector3 currentPosition = childrenSegments[i].position;
    16.  
    17.                     // Get the next segment, wrapping around if we're at the end of the list
    18.                     Transform nextSegment = childrenSegments[(i + 1) % childrenSegments.Count];
    19.  
    20.                     // Calculate the direction vector between the current and next segments
    21.                     Vector3 direction = (nextSegment.position - currentPosition).normalized;
    22.  
    23.                     // Calculate the angle between the direction vector and the segment right vector
    24.                     float angle = Vector3.Angle(direction, segment.up);
    25.  
    26.                     // Calculate the rotated direction vector based on the angle
    27.                     Vector3 rotatedDirection = Quaternion.AngleAxis(angle, segment.up) * direction;
    28.  
    29.                     // Calculate the position of the first lane based on the offset from the center
    30.                     Vector3 firstLanePosition = currentPosition + rotatedDirection * laneCenterOffset;
    31.                     Vector3 firstLanePositionMirrored = currentPosition -rotatedDirection * laneCenterOffset;
    32.  
    33.                     // Calculate the positions of the other lanes based on the position of the first lane and the lane offset
    34.                     Vector3 newPosition = firstLanePosition + rotatedDirection * laneOffset * (j - 1);
    35.                     Vector3 reversePosition = firstLanePositionMirrored - rotatedDirection * laneOffset * (j - 1);
    36.  
    37.                     //Add first lane
    38.                     lanePoints.Add(newPosition);
    39.                     reversePoints.Add(reversePosition);
    40.  
    41.                 }
    42.                  tsMaingManger.AddLane<TSLaneInfo>(lanePoints.ToArray(), laneTolerance);
    43.                 if(reverseDirection)
    44.                 {
    45.                     reversePoints.Reverse();
    46.                     tsMaingManger.AddLane<TSLaneInfo>(reversePoints.ToArray(), laneTolerance);
    47.                 }
    48.             }
    49.         }
    I added the points using my spline points I created in blender. The lanes are created using offsets from the center spline
    Also there is an issue with the vehicles stopping and going
    https://drive.google.com/file/d/1hHQTwr6AoHYXigi9b2b2n0c5k5yd2wkL/view?usp=sharing
    Thank you so much friend for the help!
     
  24. TonismoGames

    TonismoGames

    Joined:
    Jun 12, 2018
    Posts:
    109
    I think the vehicle stopping and going is caused by not having the the direction on the spline. When I use AddLane method how do I set the direction of the spline?
    upload_2023-4-11_19-1-34.png
     
  25. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    I know this could be really dumb question but just in case, did you process the road data using the process road button on ITSManager? that adds more data to the generated graph of the road for letting the AI know where they should slow down or speed up.
     
  26. TonismoGames

    TonismoGames

    Joined:
    Jun 12, 2018
    Posts:
    109
    upload_2023-4-13_15-59-41.png
    Yeah I hit Process Junction and still facing the same problem. The problem is the AddLane( Vector 3 points..) method doesnt add the direction arrow line like when adding the lanes manually from Scene View.
     
  27. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    hmm weird, try checking how the 2 third party asset scripts for road creation are doing it, one is for CiDy City generator and the other one is for Easy roads, any of the 2 you can check out to see how it is done there.
     
  28. TonismoGames

    TonismoGames

    Joined:
    Jun 12, 2018
    Posts:
    109
    Thank you so much for the help I will look into it now
     
    rhodnius likes this.
  29. TonismoGames

    TonismoGames

    Joined:
    Jun 12, 2018
    Posts:
    109
    Hi friend. After reviewing the 3rd party codes , I found that it is using the same method as I am. I think the problem is the points are created without directional arrows thus causing the vehicles to stop and go. upload_2023-6-14_16-36-50.png
    Perhaps on next update you can add to the method to include directional arrows when it is generated by script? Thank You
     
  30. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    It auto sets the direction, from the starting point to the next point, that's how direction is calculated
     
  31. TonismoGames

    TonismoGames

    Joined:
    Jun 12, 2018
    Posts:
    109
    Thank you for the quick reply. How come it doesnt show the direction gizmo in the scene?
     
  32. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,332
    the direction is shown by the big arrow on middle of the lane, it does not uses the Unity Arrows that point all axes out, as that does not exist on the data