Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Modular Traffic [PlayMaker AI] & 3D Road models

Discussion in 'Assets and Asset Store' started by 600, May 14, 2015.

  1. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Great that you got it working!

    If you want them to spawn x amount at start, pm me I will send a screenshot of what changes to make on spawners FSMs.
     
  2. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    Do AI cars utilize turn signals?
     
  3. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
  4. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Last edited: Apr 14, 2017
  5. Ricemanu

    Ricemanu

    Joined:
    Apr 12, 2015
    Posts:
    2
    Hi there,
    I'm interested in getting Modular Traffic for our project, but we need functionality for setting waypoints. Is there any way i might be able to do that with your asset?
     
  6. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Hi, thank you for the interest.
    This is a template project and not as plugin, it will not generate waypoints. It must be set manually if used the same approach - waypoints are there, you can adjust them per sector.
    Waypoints could be generated with other custom methods, but have to check if that will work with Modular Traffic out of the box or must edit some logic to recognise newly generated waypoints (for example EasyRoads plugin can generate them).
     
  7. Ricemanu

    Ricemanu

    Joined:
    Apr 12, 2015
    Posts:
    2
    Thanks for the quick reply. :)
     
  8. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
  9. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    ^ 3 days left! :D
     
  10. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    The last day! :)
    > Link
     
  11. priestor

    priestor

    Joined:
    Jun 22, 2017
    Posts:
    1
    Hello,

    I m also having a question regarding the handling of dynamic generated waypoints on runtime. Lets say I have a specifc car, that I want to manually navigate on the map/streets via mouse click. That means the destination point is fixed and the AI should figure out the smartest way to get there, but also stop on street lights etc.

    Is this kind of behaviour already supported? So I can just feed a destination point?

    Thank you. Cheers
     
  12. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Hello,
    No this kind of behaviour is not in the asset. That would need a custom logic or another asset for pathfinding, something like GPS system where AI consider the available street lanes to meet its destination.
    Obstacle and street light detection can be used form this asset, but not dynamic waypoints or shortest way calculations.
     
  13. TiToMoskito

    TiToMoskito

    Joined:
    Jan 28, 2014
    Posts:
    66
    Is it possible to use it without Playmaker?
     
  14. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    No, the functionality is made 100% with Playmaker.
     
  15. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    Good evening. I'm using your plugin with PlayMaker 1.8.5 on Unity 2017. Aside an "animator.IsControlled" deprecated call everything is working smoothly.
    But the pedestrians don't stop on red lights.

    It seems that on PedTriggers the fsm get stuck on Gets angle to ped state, specifically on GetSignedAngleToTarget action. No value is returned, PedAngle_f variable stays on 0, and the event FINISHED is never called.

    I congratulate you guys for this awesome system, but I really need to solve this issue since my project will be an educational one, so enforcing security on traffic is mandatory.
     
  16. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Hi, thanks for informing me, I will check it out today and let you know.
     
    Galahad likes this.
  17. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Follow these steps for current imports on Playmaker 1.8.5 + Unity 2017:

    1. Delete action “AnimatorIsControlled”.
    2. Delete action “GetSignedAngleToTarget”.
    3. Download and re-import the action “GetSignedAngleToTarget” from Ecosystem.
    4. Change Agent actions for Pedestrian prefab in Walk FSM like in the screenshot, but for the “Agent Stop” state set “Is Stopped” to True.

    AgentAction.png

    I will submit this updated version to Asset Store today, if anyone needs it sooner contact me on support email or personal message on forums with your invoice number.
     
    Galahad likes this.
  18. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    That was lighting fast! And on a Sunday on top of that. Thank you very much. I'll leave a good review for you guys =D
     
    600 likes this.
  19. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
  20. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    Hello, I've downloaded the updated version but the issues persist. I tried following the steps mentioned but there is no Set Agent is Stopped action. =[
     
  21. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Hi! Do you have Playmaker 1.8.5?
    Try re-download Pathfinding package from Ecosystem or Playmaker WIKI:
    https://hutonggames.fogbugz.com/default.asp?W1174
     
  22. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    Hi.
    I'm using Playmaker 1.8.5 and I have the pack mentioned, but it doesn't have the required action. The closest to it is:
    "Set Agent Stopping Distance"
    Which have different funtionality I guess.

    Regards!
     
  23. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Weird, just tried again with fresh project and there is this action.
    Did you download for the correct version?

    PathfindingPack.png
     
    Galahad likes this.
  24. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    You were absolutely right, I was using an older version that had 4 missing actions, including the one I needed.
    Now it's working flawlessly. Thank you very much for your accurate support and for your patiency.
     
    Last edited: Oct 24, 2017
    600 likes this.
  25. JormaRysky

    JormaRysky

    Joined:
    Feb 24, 2013
    Posts:
    5
    Hi.

    What is best way to remove cars and peds? My preferred method (Just simple destroy script) works otherwise fine, but UI still thinks vehicles exists and that (or whatever is under the hood) prevents spawning new vehicles on streetblock.
     
  26. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Hi,
    If AI get destroyed you can subtract value from TotalPeds and TotalCars child UI scene objects.

    For the streetblock, when vehicle enter/exit the block it triggers lane value, to make it busy or not on the CarWP_Group object. So when destroying a vehicle that number must be set back manually. FSM on AI could work, for example the LaneNR.
    Make a new global event that you call to self delete, but before destroy subtract 1 from his current CarWP_Group’s (taken from Waypoint FSM) lane value (taken from LaneNR FSM).

    If you want to share your FSM setup screenshots contact me on support email.
     
  27. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    I'm having some issues to adapt the prefabs to new meshes, follows a video of it:



    There are any rules to adapt the waypoints and colliders/triggers without breaking the logic?
     
  28. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Triggers can be put in grid style like in the asset or custom shape, but check so they don’t overlap in all directions where AI can be, including for the bridges so there is space to put other trigger under it.
    MT_Road_Waypoints_withModules.jpg

    For pedestrians, must bake the navmesh after map edit and set the walkable zones.
    MT_Intersection_NavMesh.jpg
     
  29. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    Had no luck customizing it. The AI still doesn't act as intended. I'll be forced to use your models since I've been trying to adapt to my models for over 3 weeks. Please, a more detailed documentation or even video tutorials for applying your system to other models would be very welcome.
     
  30. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Thanks, I will update the docs about using with other models. For now I have some images for vehicles, please send me an email to support[at]pamani.net so we can exchange screenshots.
     
  31. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    I'm using your default prefabs on my city, it's easier this way. But now the wheels stopped rotating and turning, what could cause this?

    [Edit]
    Never mind, it solved itself.

    How about the pedestrians, there is any extra-step on using another models?
     
    Last edited: Nov 20, 2017
  32. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Hi, sent you a private message, please check.
     
  33. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
  34. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
  35. Pug-Man

    Pug-Man

    Joined:
    Apr 18, 2018
    Posts:
    2
    Are there any plans to add support for more Synty Studio assets?
     
  36. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Unfortunately no, but the current Simple-Traffic prefabs can be used as base for custom changes.
     
  37. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    Hi @600 I've just downloaded your assets and am keen to have a play. In 2018.1.5f, I'm getting the following error:

    Assets/ModularTraffic_forPlayMaker_v1.1.3/PlayMaker Custom Actions/Trigonometry/GetSignedAngleToTarget.cs(13,15): error CS0101: The namespace `HutongGames.PlayMaker.Actions' already contains a definition for `GetSignedAngleToTarget'

    Do I just delete that script?

    EDIT: Actually I'm running into a whole range of issues. Need to investigate further. @600 have you tried a fresh install of your car setup / traffic assets on a recent version of Unity? With the latest Playmaker? Is it all working as it should and if so is there a specific order the assets need to be installed in?
     
    Last edited: Jun 21, 2018
  38. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Hello,

    Will check it out.
    There was minor issue for Car Setup with 2018.1 where needed to download Playmaker Utils from Ecosystem to replace the old ones that come in the asset.

    GetSignedAngleToTarget action issue I think was resolved, let me check again, there was issue that action having old code and had to download it again from Ecosystem to update it.

    Other than that Traffic should be imported first, then Car Setup, then Playmaker Utils and then Playmaker.

    Will get back to you after testing.
     
  39. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    Cool. Thanks. But re the install order, is it possible to install Playmaker Utils before Playmaker?? I thought I needed Playmaker+ecosystem to then be able to get the Utils. I'll try again though.

    PS - after trying a few different things (including removing Playmaker actions from Car Setup or moving them to the equivalent Playmaker asset folder, I think I'm close. The hopefully last hurdle maybe just a Playmaker issue...

    Assets/PlayMaker Utils/PlayMakerUtils_FsmVar.cs(300,33): error CS0619: `UnityEngine.ProceduralMaterial' is obsolete: `Built-in support for Substance Designer materials has been removed from Unity. To continue using Substance Designer materials, you will need to install Allegorithmic's external importer from the Asset Store.'

    EDIT: Updating Playmaker addons again seemed to have fixed things. It was a pain to get it setup because the playmaker menu item wouldn't appear unless I fixed the traffic system errors (so I had to download playmaker packages and actions from GitHub). Everything is now working perfectly as far as I can tell!
     
    Last edited: Jun 21, 2018
  40. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Thanks for the update.
    I should make a new import steps for both packs.
     
    transat likes this.
  41. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
  42. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    429
    Hi there, using Modular Traffic 1.1.3 with Unity 2017.4.2f2 and PlayMaker 1.9.0.p4, the modular traffic asset runs in the editor but it won't build an exe. The output in the console reads as:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. HutongGames.PlayMaker.Actions.TriggerEvent.OnPreprocess () (at Assets/PlayMaker/Actions/Physics/TriggerEvent.cs:42)
    3. HutongGames.PlayMaker.Fsm.Preprocess () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1632)
    4. HutongGames.PlayMaker.Fsm.Preprocess (UnityEngine.MonoBehaviour component) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1619)
    5. PlayMakerFSM.Preprocess () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:224)
    6. HutongGames.PlayMakerEditor.PlayMakerBuildCallbacks.OnPostprocessScene () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/PlayMakerBuildCallbacks.cs:34)
    7. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    8. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    9. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    10. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    11. UnityEditor.Build.BuildPipelineInterfaces+AttributeCallbackWrapper.OnProcessScene (Scene scene) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:91)
    12. UnityEditor.Build.BuildPipelineInterfaces.OnSceneProcess (Scene scene, Boolean strict) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:304)
    13. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    14.  

    Edit: fixed by removing the "public override void OnPreprocess()" code from TriggerEvent.cs
     
    Last edited: Jul 15, 2018
  43. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
    Would this asset work with "Dungeon Architect" city generation?
     
  44. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Not straight out of the box. Would need to refactor many things for waypoints and how they are generated at runtime and managed by AI. My asset use pre-set waypoints in Editor while not at runtime.
     
  45. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    Hey there @600, is this navmesh based only, or does / can it use waypoints instead? My setup just doesn't seem to like navmesh well, so I have been using waypoint based things.
     
  46. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Hello, cars use waypoints, pedestrians use navmesh to get to their waypoints.
     
  47. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    Ah, ok, thanks for the info.
     
  48. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
  49. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Hello,

    Any update to make this works in real time ? so if i make a UI for users to place the roads, later after exiting the "build mode" cars and people can spawn and move around, or better of the cars and people are spawned on demand too.
     
  50. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Hello,
    Such system not planned as it is specific for certain game types, I wanted to keep this pack simple and as base for various scenarios to expand further.
    Currently traffic would follow road if you place them on runtime, would need to make custom spawner that search for available waypoints and place the AI with start values and then they would follow until road ends. However pedestrians would need different pathfinding as originally they rely on baked navmesh, not dynamic if placed road in-game.