Giter Site home page Giter Site logo

Comments (12)

mchrbn avatar mchrbn commented on May 9, 2024 1

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.

menez1111 avatar menez1111 commented on May 9, 2024 1

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.

mchrbn avatar mchrbn commented on May 9, 2024

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.

menez1111 avatar menez1111 commented on May 9, 2024

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.

https://youtu.be/r6a64Lky72k

And this video shows why I use a lot of segments :

https://youtu.be/pw7gx0YM9No

from unity-traffic-simulation.

mchrbn avatar mchrbn commented on May 9, 2024

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.

menez1111 avatar menez1111 commented on May 9, 2024

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.

mchrbn avatar mchrbn commented on May 9, 2024

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.

mchrbn avatar mchrbn commented on May 9, 2024

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.

menez1111 avatar menez1111 commented on May 9, 2024

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.

menez1111 avatar menez1111 commented on May 9, 2024

Probably it can detect but i need to use another layer for player car because of a few reasons.

from unity-traffic-simulation.

mchrbn avatar mchrbn commented on May 9, 2024

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.

menez1111 avatar menez1111 commented on May 9, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.