Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-1
Question by HolBol · Jun 27, 2010 at 06:11 PM · carsystemcityroadstraffic

making a traffic system

I have a city roadmap, and i was wondering: how do I make a simple traffic system where cars stop at lights etc?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image twinnightmare · Jun 27, 2010 at 06:32 PM 0
Share

This is probly something you could break down to smaller questions.I would also think its a little vague.

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by twinnightmare · Jun 27, 2010 at 06:37 PM

On the light stopping part I would direct you to using triggers, Specifically OnTriggerEnter to detect when object reach's a light. and OnTriggerStay to update weather the object need's to keep stopped or proceed. Collider class

[Edited 1] Way-points would work for a system of paths with cars following them like your wanting.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HolBol · Jun 27, 2010 at 06:41 PM 0
Share

and how about getting the cars to stay on their side of the road and moving the cars aswell, would waypoints work?

avatar image e-bonneville · Jun 27, 2010 at 06:43 PM 1
Share

That's a trick job, but yeah, waypoints should work. You would need to put the movement script inside an if trigger to be disabled at lights. Create a trigger that makes the car stop at lights by calling the if statement.

avatar image HolBol · Jun 27, 2010 at 06:56 PM 0
Share

Genius, but maybe not disable the script, but get the car to apply the brakes, otherwise it will just keep rolling forward? Or is there away to get it to slow down if it's in the light trigger object?

avatar image twinnightmare · Jun 27, 2010 at 07:13 PM 0
Share

See the question on would it keep rolling forward depends on how your moving your car's? The way i would do it is your car would have a script with a variable bool stopped; when your car enters the light's trigger you set the cars to stopped to true if the light is red, then in the OnTriggerStay you would check if the light was green if it is then set the car stopped to false. Then in the update part you would check weather the car is stopped if it is then you would not move.

avatar image
-1

Answer by Kethis Celebes · Jun 28, 2010 at 12:53 AM

There are agent-driven traffic simulations which Civil(?) Engineers use. Try looking into those, to see what tricks they use.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

How to create a system of damage to a racing game 1 Answer

Roads and traffics system Made my system extremely slow 0 Answers

Accessing local system ( File Browser ) 2 Answers

Finding center and/or lanes of road mesh 0 Answers

Pathfinding with Roads 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges