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

Edy's Vehicle Physics - official thread

Discussion in 'Assets and Asset Store' started by Edy, Jan 19, 2012.

  1. alex1560

    alex1560

    Joined:
    Sep 3, 2012
    Posts:
    15
    Hi Guys, Anybody can help me with a function to stop the car when a button is pressed like it stops when changing another car.. This is the disable function that I've found in the main car controller script.. It's not working when I am trying to call it, I've used if (Input.GetKeyDown("q")){ m_Car.rigidbody.velocity = Vector3.zero; } but this doesn't stop very real.. This is the main function in the disable car.. If anybody could help me, I will appreciate a lot..

    function DisableCar(Car : CarControl)
    {
    // Desactivar elementos visuales

    var CarCams : CarCameras = Car.GetComponent(CarCameras) as CarCameras;
    CarCams.showFixedCams = false;

    // Desactivar otros elementos del coche

    Car.motorInput = 0.0;
    Car.brakeInput = 1.0;

    var Settings = Car.GetComponent(CarSettings) as CarSettings;
    if (Settings)
    Settings.bypassABS = true;

    // Asegurarse de mantener la configuración apropiada

    Car.readUserInput = false;
    }
     
  2. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    Just bought the package, great work man!

    Hay algún tutorial o documentación sobre como modificar la cantidad de ruedas de los carros?
    Mi idea es simular moto o triciclo.

    Thanks a lot for the great work!
     
  3. r4mkum4r

    r4mkum4r

    Joined:
    Jul 25, 2012
    Posts:
    8
    Is this the Official thread for Edy's Vehicle Physics .

    If yes why isnt Edy replying ?

    No response for PM as well :(
     
  4. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    Bump!
     
  5. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    At the telemetry, note the line that reads "Grip: F: 1.00 R: 0.50 ...". That "R: 0.50" means that the rear wheels' grip is now 50% of the regular grip, as result of the rear wheels being slipping. You can control how much grip is lost at this situation with the parameter sidewaysDriftFriction of CarControl.

    Same as above. Use the parameter sidewaysDriftFriction for controlling how much grip is lost when heavily accelerating / braking.


    Thanks! Packages are coded for 4 wheels, but you should be able to easily code more or less by following the same steps for the existing ones. Note that the minimum wheels are 3, as 2-wheeled vehicles are a totally different physic system - they will always fall on their side.

    Sorry, heavy rush on other project, as well as continuing development of my vehicle physics. Catching up with the PM's and emails now...
     
  6. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    Al that I do for switching cars is to disable the user input at the old one and ensuring it keeps its brake value to full (1.0). Then I enable the input at the new one, so it receives the actual values from user input (including braking, so it gets released).

    The sample scene works that way. Please compare it with yours. Maybe you're using your cars in a different way that prevents the user input to be disabled and/or the brake to keep pressed.
     
  7. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    GREAT tool! Thanks!
     
  8. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    Thank you man,
    i imagine a motorcycle made in a way similar to (rapidUnity two wheel vehicle editor resource pack) it is done by lowering the COG so the bike balances on the 2 wheels... like a pendulum, not real at all, but for my purposes a great solution... this is possible with Edy's, right?



    Gracias!
     
    Last edited: Sep 26, 2012
  9. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    705
    Edy you can use my SmartWheel for fast wheels creating too :) Let me know on email I will send you copy :)

    And as always looking into new updates.
     
  10. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    Sure, but using the cheap trick of lowering the center of mass requires you to use other tricks as well: accelerating and braking also makes the vehicle bank longitudinally in the opposite way: the front will lower when accelerating, and will be raised when braking.

    Other than that, sure, it would work.

    That would be great! Recently I've got some car models which come with rim but no tire. Thanks!!
     
  11. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    Muchas gracias hermano!
     
  12. r4mkum4r

    r4mkum4r

    Joined:
    Jul 25, 2012
    Posts:
    8
    Hi Edy,


    When in DriverCamView the car shakes too much how to control that ?

    And is it possible to achieve car simulation like in 3D Driving school ?

    If yes where do i start experimenting in your package since i am new your help would be really great .

    Thanks already .
     
    Last edited: Sep 27, 2012
  13. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    140
    Edy: do you have any quick tips for optimizing this for mobile? Obviously turning off the damage script will help, but what other things could one do?
    I tried it with the AI and the Super Coupe in a clean scene with no materials and it is running at something like 15-20 fps. I guess the cars themselves are pretty high resolution for mobile...
     
  14. spede

    spede

    Joined:
    Sep 14, 2012
    Posts:
    40
    Hi Edy,

    this is such a great package, the driving model seems really good and I'm having a lot of fun just experimenting with different parameters :). One problem I'm having currently though is that the car accelerates a bit strangely at high speeds when driving up a hill or in a banked turn. In level ground the top speed of my Sports Coupe is about 160kph, but driving up a hill it can speed up to 180-190kph, depending on the slope of the hill. With the realistic truck the speedup is less noticeable, but it still happens, so I think it is not dependent on the settings of the car. A same kind of effect happens in banked turns, the car accelerates a lot when the road turns sharply and one is driving high up in the bank. It seems to me that the curvature of the road is somehow causing extra acceleration to the car. This makes Indianapolis 500 and roller coaster type tracks hard and unpredictable to drive on. Any idea what might be causing this, and how to prevent it?
    I've also noticed that increasing gravity in Unity physics from the default value y=-9.81 speeds up the car. I don't need non-Earth physics but this might be related.
    It's easiest to see these effects in the TheCity scene if you change the Ground1 material to 'none' and drive fast to the hills. (driving on paved hills is also good fun:))
    Thanks in advance.
     
  15. Wenceslao

    Wenceslao

    Joined:
    Feb 7, 2009
    Posts:
    142
    I've actually been experiencing the same thing. I don't have many hills but I was trying to make banked tracks with EasyRoads3D and I noticed some goofiness in accelerating up the bank sometimes and wheel impact noises playing at every edge of the mesh.

    Right now I'm playing with all the parameters trying to get a better understanding of what they do so I can 1) Create a car that feels like an F1 car and 2) Identify which parameters can be modified to reflect "upgrades" the user does.
     
  16. Acelondoner

    Acelondoner

    Joined:
    Jul 27, 2012
    Posts:
    101
    @Edy

    Are you planning to release more updates? Also, are there any plans to have a c# version?
     
  17. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    Some of these queries have been answered by email, but I'll post the replies here so everyone could make use of them :)

    DriverCamView: The movement of the camera is defined by a rigidbody connected to the car with a configurable joint. Probably the easiest way for configuring the amount of movement is to change the mass value for that rigidbody. It's actually 0.5, but if you set it to 0.001 the camera will have very little movement.

    If you want to fine tune the movement, you can change the values of the Springs and Dampers for the configurable joint. The Springs are actually 50, but a value of 500 will make the driver cam view almost fixed to the car.

    I haven't played the game you mention, but the simulation can be fine tuned in a variety of ways in order to achieve the desired result. The 4 vehicles at the demo have been configured in greatly different ways in order to make them feel different. Hints for configuring the behavior can be found at the documentation:

    http://projects.edy.es/trac/edy_vehicle-physics/wiki/CarControl

    A good starting point would be to take one of the pre-configured vehicles, then go through the documentation and test changing each parameter independently, from extremum values and back to the original. This will allow you to learn how each parameter influences the vehicle's handling and behavior, and eventually you will be able to configure the vehicle in the exact way you want.

    The framework works fine on iPhone 4, as you can see at this video:

    http://www.edy.es/dev/2012/07/a-success-history-on-iphone/

    I recommend you to read this article about performance and optimization. It gives some useful hints on optimizing an application using Vehicle Physics:

    http://projects.edy.es/trac/edy_vehicle-physics/wiki/PerformanceAndOptimization

    I don't think those cars are too heavy. If you are using the city scenery, that may be too heavy indeed. Start with a simple plane. You can also disable things on each test in order to find out which one is taking your cpu exactly. Also, CarDamage only takes CPU when colliding, but it doesn't affect the regular FPS rate.

    This problem is caused because the way the WheelCollider works. Due to the (in)famous WheelCollider bug, the wheel must always be exerting all its force (is not reduced with speed). Top speed is limited by air drag only. In addition, the WheelCollider assumes that the wheel is always sliding over the ground, and the resulting force depends on the vertical downforce.

    When driving on a hill the downforce gets suddenly increased, so does the resulting force, and the speed increases as well. This effect can be dramatically observed if you manage to hit the bus from behind with the sport coupe and put the car under the bus. Then accelerating the sport coupe will cause a super force, instead of staying blocked under the huge mass.

    Possible fixes for this behavior could be with workarounds on the symptoms, i.e. detecting when the road slope increases and reducing the motor force temporarily.

    A C# version translated by Peter Fonk is available at the project's downloads for people who purchased the package. I'm now working on my next product, Vehicle Physics Pro, with a proper tire model, engine and drivetrain simulation. I expect it to be ready by the end of the year.
     
  18. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    Hate to be critical of yet another asset store purchase, but just bought this and sadly it does not inspire confidence...

    Seeing 6 errors on import, all about missing classes; contrary to what the docs say, these classes are NOT included in Standard Assets (have different names).

    Includes tons of outdated standard pro assets, which cause even more errors if you have updated versions; when will dev's understand... DO NOT INCLUDE STANDARD OR PRO ASSETS EVER! Deselect them on the package export dialog; if user has them, their versions will be used.

    Also, package creates folders spread all over the project; when will this end? It's very simple: ASSET STORE DEVS, ALWAYS PUT ALL OF YOUR ASSETS UNDER A SINGLE PARENT (if not needing Plugins folder)... otherwise you your asset looks VERY unprofessional it breaks most user's projects; professional users ABSOLUTELY HATE THIS! Asset Store has been around for over 1yr; there's no excuse anymore!

    Also, yes, purchased this on Asset Store and yes everything is in .JS... where is the .CS version for users who purchase on the main channel for Unity extensions, the Asset Store? You tell me.

    At the very least verify your package with each new Unity point release fix import errors... if you don't, you and your package looks very amateurish. I mean, am happy you've moved on and are working on a pro version, but why should that mean the current version on Asset Store doesn't get updated?

    Disappointed.
     
  19. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    Adding to this, opening TheCity scene in a completely empty project gives a fatal error 100% of the time...

    This is unacceptable for a $50 package and wastes the time of anyone buying this... If you don't care enough about your users to ensure your packages work with the latest Unity, then why should we users care enough to pay you?

    It doesn't take any time for you to test your own stuff... how can you possibly be too busy for this?

     
  20. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    I believe it's important to clarify things here. First, the video:



    Second, the package is in the category Complete Projects in the Asset Store. I think it's a serious risk to take any of the projects here and import it right into an existing project.

    Errors on import: for reasons beyond my understanding Unity confuses my Camera classes with the ones from the Standard Assets, despite the fact that they are named different. So when creating the list of files to import, if the Standard camera classes are present, my own camera classes are not even listed. Anyways this is is a consequence of the previous point (a Complete Project mixed up with an existing project).

    Including Standard Assets, using single folder, etc: again, this is related with the first statement. This is a Complete Project that runs out of the box. I wouldn't expect any complete project to be contained into a single folder inside Assets.

    CS version: please send me the invoice number to my email (edytado @ gmail.com) and I'll send you the login data for the projects page, where you can find the project in several formats (CS, zipped, 7z, unitypackage). I code in JS only, this is my choice. Peter Fonk was kind enough to translate the project into C# and let me distribute the translated version.

    All other inquiries, I hope they have been answered with the video. Please let me know if you have further questions or comments.

    Edit: Including Standard Assets in a Asset Store package also doesn't depend entirely of the developer. In other of my packages I specified explicitly a single folder for inclusion. However, in order to include a demo scene I had to use the Character Controller from Standard Assets. Despite the Standard Assets folder being outside of my product folder, Unity automatically included any dependencies in the package for the Asset Store. I would have had to choose among not including a demo scene, or letting Unity include dependencies. Of course, a Demo Scene is much more important.
     
    Last edited: Dec 13, 2012
  21. ChinoNino

    ChinoNino

    Joined:
    Jul 22, 2012
    Posts:
    8
    Hey Edy I just bought your vehicle project and wanted to know your email so that I can send you my invoice. I would like to download the c# version since that is what I'm familiar with.
     
  22. Alex_V

    Alex_V

    Joined:
    Jun 25, 2012
    Posts:
    53
    Hi Edy,
    How can we know your plans for the Pro version?
     
  23. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    Mail me to edytado @ gmail.com.

    A proper tire model, drivetrain, gearbox, engine and aerodynamics simulation. Everything using simple math and inexpensive formulas. Easy to fine-tune for gameplay, yet providing highly realistic results.
     
  24. Alex_V

    Alex_V

    Joined:
    Jun 25, 2012
    Posts:
    53
    Nice, have you estimated the development time? :)
     
  25. ChinoNino

    ChinoNino

    Joined:
    Jul 22, 2012
    Posts:
    8
    Hey Edy you never seemed to have responded to my email.
     
  26. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    It's a R&D work, but I expect it to be completed around the end of the year, or early next year.

    My mailbox is up-to-date at this time. Please resend the email if you haven't got reply yet.
     
  27. xcube

    xcube

    Joined:
    Nov 27, 2011
    Posts:
    45
    Hi Edy,
    Is it possible to make such a game on your engine?
    Here 2D machine (sprites) has two wheels. Camera view only one side. For iphone.



    If so, please tell us briefly how this can be done.
    Thank you!
     
  28. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    You could set the rigidbody constraints to lock movement in the X direction and allow rotation around the X axis only (change X for Z if you're using the XY plane).

    However, for that kind of game I would better develop a simple physics system based on AddForceAtPosition. I'd compose a 2-wheeled vehicle using a rigidbody and 2 WheelColliders. I'd apply the mentioned constraints to the rigidbody. The WheelCollliders would be configured for suspension only, and motorTorque and brakeTorque would always be set to 0.

    Then all you have to do is to monitor the WheelCollider contacts (WheelHit) and use rigidbody.AddForceAtPosition(force * WheelHit.forwardDir, WheelHit.point) for applying the force to the vehicle. You can use the downforce (WheelHit.force) and the user input for calculating the resulting force. Ensure to clamp the resulting force to some limit (i.e. WheelHit.force * coefficientOfFriction), as WheelHit.force could have huge values when impacting the ground.

    This method is a lot easier for achieve a specific gameplay in the game, as you have to control very few parameters. You could also build your vehicle system around it (i.e. force depending on current gear gear ratio, etc).
     
  29. xcube

    xcube

    Joined:
    Nov 27, 2011
    Posts:
    45
    Edy thank you very much for your help!
     
  30. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    Edy,

    Working on a skateboarding game, and I just integrated your vehicle solution. Works great, and had a skateboard up within 30 minutes. My only problem currently is that whenever I take the board off a ramp, when it hits the ground, 2 of the wheels often get stuck in the ground and I can't get them to come out. Usually I fix this by setting the Collision Detection to Continuous Dynamic, however the wheels don't have that option. Could you please suggest some solutions that I could try to address the problem?

    Thanks in advance!!
     
  31. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    Solved my problem. I had to add 2 capsule colliders - one for the front wheels, one for the back. Problem was that the way the wheels for the skateboard are, they were not registering collisions with the ground. I realized this when I saw that the board itself NEVER went through the ground - the wheels would easily go through it. So a quick pair of capsule colliders did the job.

    Great package, Edy - thanks again!
     
  32. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    Hi, glad to hear that you fix the problem. The center point of the WheelColliders should always be inside a regular collider. This point is the origin for the raycast that detects the wheel contacts, so if it goes through the ground then no contacts will be detected. You may not need Continuous collision detection at all.
     
  33. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    Unfortunately this looks like my solution didn't really fix the problem, because now I'm running into a situation where the additional colliders I made, the cylinders, are rubbing against the ground and creating lots of friction. So going back and looking closer at this - I'm finding my real problem is that the wheels do not always properly collide against the ground, which is resulting in them very frequently going through the ground.

    So let me go through this carefully. I want to make sure I have this setup right. I took your advice above as well and made sure each wheel had its own collider. Here is my setup:
    - Each wheel has a Mesh Collider in the shape of the wheel.
    - Each wheel has a separate Wheel Collider object.

    With that setup, right away when the level starts, I see some weirdness in the colliders. Check out these images... the first here is from in just the editor:



    You can see in that shot that the wheels are matching up with the axles on the skateboard, and you can see the green rings for where the wheel colliders are. Note that the wheel mesh colliders are placed on the wheel meshes themselves, so they match up.

    Now check out this image of the game playing. This is right after hitting Play and letting the skateboard fall to the ground:



    In this image, you can see that something went wrong. The wheel meshes are now BELOW the axles rather than attached to them, and the wheel colliders are still where they were before. While moving the skateboard around through the environment, anytime the skateboard is flipped into the air, you can see that the wheels are spazzing out and jittering up and down real fast. I've tried setting the spring, damper and target position of the wheel colliders to 0, but that just seems to make it jitter less - this problem still occurs.

    What could you suggest that I could do to make my wheels line up properly and act like real skateboard wheels?
     
  34. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    That looks like a visual problem. WheelColliders are properly over the ground, but the visual mesh seems to be positioned as if the suspension is completely extended.

    This may have to do with the raycasts at CarVisuals failing to detect the floor. Check out the function DoWheelPosition (called from Update) in order to see why is it failing to find the proper position. Note that any collider placed in the layer 2 (ignore raycasts) won't be properly detected.
     
  35. skatermichi98

    skatermichi98

    Joined:
    Feb 5, 2012
    Posts:
    22
    How can i make physics like in the new nfs most wanted ?
     
  36. Acelondoner

    Acelondoner

    Joined:
    Jul 27, 2012
    Posts:
    101
    @Edy

    I have sent my invoice to your email requesting the C# version. Awaiting your reply. Cheers.
     
  37. tien002

    tien002

    Joined:
    Jul 13, 2012
    Posts:
    1
    Hi Edy,

    I want to pause the game and have set the Time.timeScale = 0.0 but the get the following errors

    !CompareApproximately (SqrMagnitude (q), 1.0F)
    UnityEngine.Quaternion:Euler(Single, Single, Single)
    CamSmoothFollow:LateUpdate() (at Assets/EdyVehiclePhysics/CameraScripts/CamSmoothFollow.js:90)

    transform.position assign attempt for 'Map Camera' is not valid. Input position is { NaN, NaN, NaN }.
    UnityEngine.Transform:set_position(Vector3)
    CamSmoothFollow:LateUpdate() (at Assets/EdyVehiclePhysics/CameraScripts/CamSmoothFollow.js:95)


    Easy way to reproduce this error is to change the value of

    var slowTime = 0;//0.25;

    and then hit "T" on keyboard.


    Can you advise on how to fix this?

    Thank you.
     
  38. ZiadJ

    ZiadJ

    Joined:
    Sep 3, 2011
    Posts:
    62
    @Edy Would be great to have support for force feedback in steering wheels like LG G25/G27. Is this in your plans yet?
     
  39. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    @tien002 Use Time.timeScale = 0.00001 instead

    @ZiadJ I own a G27 so yes, it's definitely in the plans :)
     
  40. Presttto

    Presttto

    Joined:
    Jan 2, 2013
    Posts:
    2
    Does anyone know how to get the car to recognize a logitech steering wheel with 900 degrees of rotation. The car turns just fine, but once I rotate the logitech wheel more than 180 degrees in either direction the game car doesnt turn any more. It seems to only respond to a portion of the total wheel rotation. Is there a bit of code I can adjust to work with my wheel.

    Thanks in advance
     
  41. Presttto

    Presttto

    Joined:
    Jan 2, 2013
    Posts:
    2
    i figured it out...it is a setting within the logitech profiler. the default is 200 degrees. i just increased it to 900.
     
  42. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    Configure the settings at the Logitech Wheel Profiler. You can specify the portion of the wheel rotation that is used for steering in any game. Adjust it to the full range, and it will work as expected.

    Edit: I've just read that you fixed it, good to know it! :)
     
  43. Rasse

    Rasse

    Joined:
    Jan 16, 2013
    Posts:
    4
    There is something weird going on in your car damage scripts.
    When you use car which contains only one solid mesh, damage works just fine, but if you use car with child objects like bumpers etc. (Connected from 3dsMAX) car won't get damage properly. It won't help if you try to define all the deform meshes. I even tried to unactivate all other meshes in the car but problem still occures. I know that it would solve the problem if I use separated bumpers, windows, mirrors etc, but thats not a good solution for this and it will generate much more work for me. Haven't tweaked yet your code, but I was wondering if you have good solution for this. It will take too much time to solve if I need to tweak the code.

    Another mayor problem in your physics is that when you are steering little bit in high speeds, car speed is decreasing way too much. I understand that the problem is small amount of slip at rear wheels. I tweaked the Pacejka parameters and the physics code a little bit and get much better results for this, but there are still some slipping at rear wheels which causes unrealistic behavior. In your demo there is same problem but it occures at oversteering.

    As you can see from the screenshot there should not be slipping in the red area. Yellow line demonstrates my modifications.


    http://www.retropelit.fi/?attachment_id=5167

    Can you advice how to tweak the code that it prevents slipping in current area? It’s hard to solve the problem because all the comments are in Spanish.

    Anyway I have now tuned the car settings to behave much more realistic. You can drift long distances without loosing car control or oversteering. Interested?

    Regards
    Rasse
     
    Last edited: Jan 16, 2013
  44. RandomXT

    RandomXT

    Joined:
    Jan 13, 2013
    Posts:
    1
    I can't seem to get the skidmarks to work in my scene.
    Do I need to add the skidmarks script or prefab to a specific gameobject?
    Do i need to set my terrain to something specific?

    thanks!
     
  45. Rasse

    Rasse

    Joined:
    Jan 16, 2013
    Posts:
    4
    1. Add skidmarks prefab anywhere in the scene.
    2. Check that there are skidmarks script in the prefab/object (In my case it's usually missing and have to add manually)
    3. Change skidmark object transform position 0,0,0
    4. Check that your terrain/material under the car does not contain any physic material in the collider.
    I guess that you didn't change the objects location to zero position.
     
    Last edited: Jan 17, 2013
  46. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    The CarDamage script contains three lists where the affected objects must be included:

    DeformMeshes: Include here all mesh objects you want to be deformed with impacts.
    DeformNodes: Transform objects which get affected in position and rotation with impacts. I use this one for including the transforms of the wheels, so impacts modify their position/orientation making the vehicle more difficult to control.
    DeformColliders: Collision meshes you want to be deformed. This allows certain coherency among the deformed visible geometry and the contact points to further impacts. However, note that mesh colliders are always recalculated to be convex (no "holes" in mesh colliders are possible).

    You should add the components of the vehicle to the above lists properly, so they behave in the way you want to.

    That makes no sense to me. In those graphs, the horizontal axis means slip velocity, meters per second. Each vertical line means 1 m/s of displacement. The vertical axis means the sideways friction force exerted by the tire at a given sideways slip velocity. So you are meaning that there should not be friction within the first 3 m/s of lateral slipping? This would result in the vehicle moving like over ice laterally until the sideways speed increases over 3 m/s, then the wheels would start to produce friction.

    Sure! Could you post your settings here? I'd really like to see a settings like yours. When developing Vehicle Physics, I've spent way more time testing fine tunning parameters that actually coding. Getting the right parameters is pretty difficult in real vehicles, and it's not easy in simulated vehicles either. You must understand what each single parameter does and how it affects other parameters. The best way is to play test each parameter individually and learn how the behavior is affected.
     
  47. Imillionaire

    Imillionaire

    Joined:
    Dec 14, 2012
    Posts:
    60
    Hey Edy is there anyway to make it so holding down the right mouse button would control the steering for the car to allow users to fine tune the steering. simply using WSAD just doesnt give the precise steering i need, u tap A or D at high speeds and the car jerks in that direction, instead of a smooth slow turn (depending on how fast you'd move the mouse).

    Also, what effects the wheel alignments of the cars? the colliders and everything are PERFECTLY straightm yet as i speed up, the car slowly starts to turn in one direction of the other. how do i fix this?
     
    Last edited: Jan 22, 2013
  48. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    246
    Did you try to tweak the minTurn and maxTurn parameters that include how the steering control is behaving at some speed?

    About wheel alignments: Try to turn off the mesh damage script.

    Peter
     
    Last edited: Jan 22, 2013
  49. Rasse

    Rasse

    Joined:
    Jan 16, 2013
    Posts:
    4
    I understand what DeformMeshes, nodes and colliders do and how to add them. Nodes ja collider deforms are working, but there won't be any dents or scratch in the car mesh surface. I assume that the problem is somewhere in the 3dsMax child object definitions, because if I add your SportCoupe FBX skin to my car settings it works just fine and your Sport Car contains child objects. I can even keep 2 FBX cars side by side and only your FBX file get dents.

    I don't know if there is no sense in my changes, but after my modifications car handling is much more realistic (With full throttle). There are some problems with half throttle which I haven't solved yet. It's best that you test my demo, so you understand what I ment. I have done all the modifications by 'gut feeling'.

    Because I have changed some of the sources, I think it's best if I send you download link to .exe file, so you can test and give your opinion about my modifications. First I have to build a test track, so it's going to take day or two.
     
  50. Rasse

    Rasse

    Joined:
    Jan 16, 2013
    Posts:
    4
    Ok, I solved the damage problem. It was a 3dsMax<->Unity scaling problem.
    If you have child objects they all must have correct scale 1:1 in unity or the damage script is not working.
    In my case the main FBX root was scaled correctly in 1:1 in unity units, but the objects under root (every child objects) was scaled to 0.1 even they looked at normal size.
    It seems that my car did get the damage correctly all the time, but the dents and scratches was so small that you didn't see them.
    I solved the problem when I added google sketchup car in the game. Sketchup cars original scale was about 0.01, so I changed it to 100 x bigger in unity. Result was that the car literally exploded and there was left just a ball of metal after crash :)