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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Simple Traffic System

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

  1. fady_samh

    fady_samh

    Joined:
    May 14, 2020
    Posts:
    2
    error CS0246: The type or namespace name 'VehicleTypes' could not be found (are you missing a using directive or an assembly reference?)
    i receive this error when importing the package to the unity project
     
  2. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507

    VehicleTypes is not a namespace in STS.
    All scripts from STS are in namespace TurnTheGameOn.SimpleTrafficSystem.
     
  3. AuKtagon

    AuKtagon

    Joined:
    Aug 3, 2017
    Posts:
    7
    I'd love to ask before buying. I am looking to use another Car AI asset that just follows a world position as best as it can. Is it easy to simply use another asset for each car instead of using the built in cars themselves?
     
  4. Homicide

    Homicide

    Joined:
    Oct 11, 2012
    Posts:
    657
    In my experience, the minute you want to use an AI that is not the provided AI for traffic systems... is the minute the traffic system starts to fall apart.
     
  5. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    STS is a controller, and just like any other controller, it's only designed to work with this package.

    This is correct. I don't know of any AI controllers that can 'just work' with any other vehicle physics or AI packages - each developers tends to do things in different ways, there are no standards.
     
  6. baibiantianhou

    baibiantianhou

    Joined:
    Jan 9, 2023
    Posts:
    1
    Hello there! When I try to draw the route points while pressing SHIFT button, the route points always float in the air without tightly attaching to the ground. Is there any technique can help sovle this problem?
     
  7. schrotti26

    schrotti26

    Joined:
    Oct 4, 2020
    Posts:
    3
    Hey there,
    how does the system handle streets that may be rotated along 2 axis? Is there an option to project the cars to always fit the road? something like that?

    Thanks
     
  8. melksnis

    melksnis

    Joined:
    Sep 30, 2020
    Posts:
    10
    Hello. I have a problem I use floating point fix in my game -that is I shift all gameobject when moved too far from origin. How can I reset car target points after I shifting. they are stored somewhere and car still wants to go to their previous locations except some that happened to reach it my accident the moment I shifted..
     
  9. melksnis

    melksnis

    Joined:
    Sep 30, 2020
    Posts:
    10
    well it worked with this
    AITrafficController.Instance.Set_RoutePointPositionArray(GetComponent<AITrafficCar>().assignedIndex);
    also any way to use yield trigger without traffic lights - I have big map and there are lets say highway and small road connecting to it. I want car to go that small road and check if no cars are coming and then drive on it
     
  10. kevindavis12345

    kevindavis12345

    Joined:
    Apr 26, 2023
    Posts:
    1
    Is there any way of disabling those green lines that point to the next waypoint? There are so many in may scene and it is distracting.
     
  11. RetrKill0

    RetrKill0

    Joined:
    Sep 4, 2022
    Posts:
    4
    Hi, I'm still new with the asset, at least I didn't find an option other than the one in configure mode spawn Points. it has the option "setup random spawn Points", but it only works if you click on it, it would be possible to add an option in the AITrafficController that we enable the spawn randown every time the game starts or the script is reloaded (eg when we put loading in the game)

    And in the AITrafficWaypointRoute, in addition to having the option use spawn points, it also has "random spawn", that way the traffic will always be dynamic
     
  12. FerjadAli

    FerjadAli

    Joined:
    Aug 4, 2020
    Posts:
    1
    i'm having this issue when i check the usePooling it generates the error mentioned below other wise it works fine

    so i was comparing with the demopooling scene and everything seems to be fine

    can anyone help ? urgently
    NullReferenceException: Object reference not set to an instance of an object
    Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckWriteAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <ab74fe8c3de74feeafac966c034df8aa>:0)
    UnityEngine.Jobs.TransformAccessArray.GetTransformAccessArrayForSchedule () (at <ab74fe8c3de74feeafac966c034df8aa>:0)
    UnityEngine.Jobs.IJobParallelForTransformExtensions.Schedule[T] (T jobData, UnityEngine.Jobs.TransformAccessArray transforms, Unity.Jobs.JobHandle dependsOn) (at <ab74fe8c3de74feeafac966c034df8aa>:0)
    TurnTheGameOn.SimpleTrafficSystem.AITrafficController.FixedUpdate () (at Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/AITrafficController.cs:262)
     
  13. Patrioc_plays

    Patrioc_plays

    Joined:
    Apr 29, 2021
    Posts:
    3
    Yooo cool asset but is there a way to change how the cars slow down/brake, cuz sometimes they just instantly stop instead of slowing down and stopping and it looks rlly bad
     
  14. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    I upgraded Unity to 2022.3.8 and am now seeing 3 warnings:


    Code (csharp):
    1. Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/AITrafficController.cs(841,25): warning CS0618: 'BoxcastCommand.BoxcastCommand(Vector3, Vector3, Quaternion, Vector3, float, int)' is obsolete: 'This struct signature is no longer supported. Use struct with a QueryParameters instead'
    2. Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/AITrafficController.cs(852,58): warning CS0618: 'BoxcastCommand.BoxcastCommand(Vector3, Vector3, Quaternion, Vector3, float, int)' is obsolete: 'This struct signature is no longer supported. Use struct with a QueryParameters instead'
    3. Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/AITrafficController.cs(857,59): warning CS0618: 'BoxcastCommand.BoxcastCommand(Vector3, Vector3, Quaternion, Vector3, float, int)' is obsolete: 'This struct signature is no longer supported. Use struct with a QueryParameters instead'
    Any suggestions?
     
  15. Patrioc_plays

    Patrioc_plays

    Joined:
    Apr 29, 2021
    Posts:
    3
    That likely isn't going to do much at all, you can ignore them I'm fairly sure
     
    Colin_MacLeod likes this.
  16. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    So I don't miss something important, I try to keep the console warning-free.

    I'll add pragmas to the code to ignore these for now :)
     
  17. Stephen_O

    Stephen_O

    Joined:
    Jun 8, 2013
    Posts:
    1,507
    Thanks for letting me know!

    I created a new package for 2022 LTS to support Collections to 2.1.4 and BoxcastCommand using QueryParameters.

    New package link:
    https://assetstore.unity.com/packag...e-traffic-system-2022-lts-265560?aid=1011lGiG
     
  18. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    Oh, nice! Thank you. I'll check it out.
     
  19. Patrioc_plays

    Patrioc_plays

    Joined:
    Apr 29, 2021
    Posts:
    3
    NullReferenceException: Object reference not set to an instance of an object
    TurnTheGameOn.SimpleTrafficSystem.AITrafficController.FixedUpdate () (at Assets/TurnTheGameOn/SimpleTrafficSystem/Scripts/AITrafficController.cs:830)

    Im getting this error whenever I turn on "Front sensor faces target" option in the AI traffic controller script
    Like it works fine for the first maybe.. 10 seconds and then I get this error and all the AI traffic vehicles go crazy, like they just speed up randomly, dont follow their way points and stuff
     
  20. shounak00_unity

    shounak00_unity

    Joined:
    Sep 10, 2020
    Posts:
    9
    So is there any Way I can use your traffic system where I can stop the card in it's track completely. Get the door open. and site and drive the car?
     
  21. shounak00_unity

    shounak00_unity

    Joined:
    Sep 10, 2020
    Posts:
    9
    More like gta v style?
     
  22. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    268
    I believe you can do this with code. I don't have the methods to hand but you would detach your car from the system by making it no longer a follower.