Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

MG Car Physics [pending]

Discussion in 'Assets and Asset Store' started by mihanocho, Oct 1, 2015.

  1. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    MGCarPhysics is a great physics model of cars. We do not use WheelCollider's why our cars are more efficient. In this package there is a choice between a circle collider and collider cyllinder. Our cars use pacejka magic formula. Try this package after playing the demo.

    To simulate engine operation points used in the graphs torque/RPM. Occurs the interpolation points. In the end, for each value of the RPM there is a Torque value. This allows obtaining accurate simulation engine.
    Screenshot_6.png


    This our Cyllinder Collider.
    Screenshot_1.png
    We create a Cylinder Collider using a Sphere Collider and Raycast. That makes the wheel more realistic.
    logicMgCC.png
    Screenshot_9.png


    Screenshot_6.png Screenshot_10.png Screenshot_9.png Screenshot_1.png
    WebPlayer
    *V = Camera
    *Num+ = Next Car
    *Num- = Previous Car
    Documentation

    Price - 25$.
     
    Last edited: Oct 18, 2015
  2. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,055
    Can you provide a little more info on the statement that your wheels are more efficient than the Unity ones, have you got some benchmark figures as to how much more efficient they are. Also I tried your demo and the car seems to move in a juddery way when turning slowly and driving on steep slopes the car seems to turn on odd directions?
     
  3. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    324
    I also did tried the demo. The performance seem not good. The drift action is bad, too. I run this on good pc, but its very lag.
     
  4. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    I think you are misleading the chamber. Switch on mouse look by pressing V.
     
  5. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    Actually, your system is bad.
     
  6. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    Why?
     
  7. Zac-Yeates

    Zac-Yeates

    Joined:
    Jan 23, 2015
    Posts:
    20
    Does your wheel collider avoid the issue where a wheel will suddenly jump up on sudden terrain changes?
     
  8. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,055
    I would be interested to hear how you do your wheel collider? Also on your docs page the mgWheel section goes to the input section, you may want to fix that.

    Trying your demo again it seems your wheels are using SphereColliders and not cylinders, is that right?
     
    Last edited: Oct 2, 2015
  9. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    Cyllinder collider used sphere hit and raycast
     
  10. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,055
    So it is using your custom Cylinder collider in there? It just seems if I go near the edge of one of the blocks it behaves as if it is just a sphere collider.
     
  11. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
    It isn't too bad, just needs some work. The car sits high and when steering, the car tends to shake(maybe make the rigidbody interpolated?).
     
  12. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    I create cylinder collider so logicMgCC.png
     
  13. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    Implementation smooth steer.
    Code (CSharp):
    1.  steerInput = Input.GetAxisRaw("Horizontal");
    2.         if (steerInput > 0)
    3.         {
    4.             steer += Time.deltaTime * steer_speed;
    5.             steer=Mathf.Clamp(steer, 0, 1);
    6.  
    7.         }
    8.         else if (steerInput < 0)
    9.         {
    10.             steer -= Time.deltaTime * steer_speed;
    11.             steer = Mathf.Clamp(steer, -1, 0);
    12.         }
    13.         else if (steerInput == 0 && steer > 0)
    14.         {
    15.             steer -= Time.deltaTime * steer_speed;
    16.             steer = Mathf.Clamp(steer, 0, 1);
    17.         }
    18.         else if (steerInput == 0 && steer < 0)
    19.         {
    20.             steer += Time.deltaTime * steer_speed;
    21.             steer = Mathf.Clamp(steer, -1, 0);
    22.         }
    23.         inputs.input_steering = steer;
     
  14. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    Demo is updated. Please point out the bugs. I really need it.
     
  15. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    324
    Still bad physics. Not realistic yet. Pure performance.
     
  16. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    Thanks for the reply! You can detail please. What needs to be polished?
     
  17. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
    1. Car movement is jerky, and the car stutters when turning
    2. Set the camera to the unity Smooth Follow camera
    3. Car sits too high
    4. Car has infinite friction, not much drift/over steer
     
    mihanocho likes this.
  18. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    Thank you so much. Now change the settings.
     
  19. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    Can put basic settings in the GUI?
     
  20. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    Demo updated
     
  21. Davidbillmanoy

    Davidbillmanoy

    Joined:
    Jul 7, 2014
    Posts:
    119
    I want horsepower, telemetry, and turbochargers. Is it the accurate car physics? If so, can I put real car specs? Oh I also want Ai.
     
    Last edited: Oct 17, 2015
  22. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296

    Engine power on this graph you can calculate by the given formula:
    float current_power = torque * rpm / 3500;
    *torque - the current value of the torque.(In MG_Engine)
    *rpm - rpm(In Mg_Engine).
     
    Last edited: Oct 18, 2015
  23. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    to increase engine power by increasing the parameter can power_factor
     
  24. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    It is accurate physics. Great scope for customization
     
  25. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    Demo updated
     
  26. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    Please be active. Describe what would like to see. That is not enough. Thanks
     
  27. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
  28. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
  29. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
    Better. Steering slows down the car too much, the car is too grippy.
     
  30. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    I think you should make different types pacejka to demonstrate
     
  31. Davidbillmanoy

    Davidbillmanoy

    Joined:
    Jul 7, 2014
    Posts:
    119
    Ai is waypoint.
     
  32. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    OK, will do later
     
    Davidbillmanoy likes this.
  33. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    Demo updated
    I made 3 types pacejka:
    1.drift(car1)
    2.standart(car2,3)
    3.truck(car4)
     
  34. Davidbillmanoy

    Davidbillmanoy

    Joined:
    Jul 7, 2014
    Posts:
    119
    I don't see the horsepower curve in the editor.
     
  35. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    The curve is not required knowing the point of intersection of the graphs
     
  36. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    float current_power = torque * rpm / 3500;
     
  37. Davidbillmanoy

    Davidbillmanoy

    Joined:
    Jul 7, 2014
    Posts:
    119
    So where's the horsepower? Does it support the latest Logitech G920 wheel?
     
    Last edited: Oct 18, 2015
  38. mihanocho

    mihanocho

    Joined:
    Mar 10, 2015
    Posts:
    296
    You are not limited in access to peremennym management. For steering a MG_Inputs.input_steer(Takes the value from -1 to 1). Connect it to the controller and the wheels will follow vechnosti driving. Likewise with the clutch, transmission brake and gas