Comments (12)
Cool glad to hear it is now working better :)
If you set the layer of your controlled car to "AutonomousVehicle" and have a BoxCollider on it, other cars should detect it no?
from unity-traffic-simulation.
Hello again. I changed void onenable to void start because when you set pasive- active a car they instantiate wheels again.
from unity-traffic-simulation.
Hey thanks for the feedbacks, for your issue, does it get better if you put a smaller value for the Waypoint Thresh? The smaller the value is, the more it should stick to the path. You can also try with a bigger steering angle value (so it turns faster).
Good suggestion for downforce, I will add it. For the wheel size, I'm not sure, maybe changing the radius value from the wheel collider is better than changing the scale?
from unity-traffic-simulation.
Hello.
Thank you for the advice.
It got better with your advice but still it did not work as much as the old system for me. I tried a lot of different things but I did not record them. I can share my project with you again if you want to test. May I made a mistake again. But I showed what is the problem for me also in your example scene. Still maybe it is not a problem for others but only for me.
This is a video about what is the problem.
And this video shows why I use a lot of segments :
from unity-traffic-simulation.
Yes would be good if you can share your project with me, so I can see how I can improve the system for various type of scene/roads!
from unity-traffic-simulation.
Thank you for the response 👍
I showed my problems in the videos in the old message. The main problem for me is cars follow the waypoints with wide angle in the new update especially in the turns. I used to solve this problem with having a lot of segments in the old version. Also, when aicars get hitted by the player car or the other ai car they were moving the closest segment with very narrow angle thanks to having a lot of segments. Achieving this with only using the waypoints would be perfect solution for me ( so we dont need to set hundreds of segments to achieve that).
from unity-traffic-simulation.
Yes there is indeed an issue with the vehicle not following properly the path when it goes fast and there is sharp turns (unless it is an intersection like a stop or red light then the vehicle should slow down) . In my example, the max speed is pretty low that's why this issue is less visible. Will look at it and keep you updated
from unity-traffic-simulation.
Check the branch dev, I've updated the scripts WheelDrive.cs and VehicleAI.cs.
As you suggested, I added a value in WheelDrive so you can set a downforce. The other thing that changed is that the vehicle will now reduce its speed before it is about to turn - you can set this value via steeringSpeedMax in WheelDrive (for example, if you set a value of 25, the vehicle's speed will be max 25KM/H when it is about to turn).
One thing that I noticed is that you should put a steering angle of at least 40 or even 50...30 is too small for sharp turns...Unless you create a curve with a lot of waypoints.
Do you think it improves your project?
Also look at these two videos: 01 and 02.
The first one is the result of these new scripts on your project; the second one is how I would create the traffic system for your project (as you mentioned, without that much segments. A segment should only be from one intersection to another).
from unity-traffic-simulation.
Hello again.
I set up the new update. It looks like everything works fine. FPS increased significantly. I am not sure about the exact number but arround 250-260 to 310-330. I did not try it for very long hours but I can easily say number of cars getting stuck also droped. I will report if something new happens.
I will launch my game soon. Your project helped me a lot. Thank you so much. If you need my project to test the things or if you want to use my cars ( cars in the garage scene created by us) you are more than welcome.
I need only one thing more and I have a few suggestions if you want to develop the project more. It would be nice if AI cars can detect player's car so they avoid to hit the player as they do each other ( thats what I need). I checked some traffic systems in unity asset store.And my suggestions are : Mostly they have a respawn point and options about that. Also, some of them have their own occlusion culling system, most probably for increasing the performance. Idk why but in mobile or just in my game dynamic occlusion decreasing the performance may it can be helpfull for other platforms performance. Thats all what I was going to report.
bandicam-2020-12-25-11-40-06-214_9JtHlsnt_M41Y.mp4
from unity-traffic-simulation.
Probably it can detect but i need to use another layer for player car because of a few reasons.
from unity-traffic-simulation.
I updated the project, you can now add extra collision layers from the Traffic System GameObject - so you can add your main car's layer name and it will be also detected by the autonomous vehicles as an obstacle
from unity-traffic-simulation.
Hello.
I tried it. If I did not make a mistake there is a small problem. Cars hits to player's car once and after that they avoid to hit again. I think it is okay. Thank you.Happy new years.
from unity-traffic-simulation.
Related Issues (20)
- Vehicles collides with waypoint HOT 4
- Editor Todo HOT 2
- isdirty HOT 1
- Recommendation for performance boost HOT 1
- Cars crashing into each other at intersections HOT 5
- New Cars collides with others HOT 6
- Set Passive - Active problem HOT 10
- Mobile Performance HOT 2
- Slow Car Bug HOT 3
- Doesnt follow waypoints HOT 9
- VehicleAI doesn't recognize segment HOT 4
- Some cars don't follow waypoints HOT 5
- Any tips for optimizing? HOT 12
- Script errors in 5.6.7f1 HOT 1
- Update to Unity's new input system
- Unable to build HOT 2
- Raycast Not working HOT 3
- deleting waypoint gives continous error HOT 1
- Trafic System doesn't work on Prefab Objects HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unity-traffic-simulation.