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

WheelCollider RPMs going crazy

Discussion in 'Physics' started by SnakeTheRipper, Apr 4, 2015.

  1. SnakeTheRipper

    SnakeTheRipper

    Joined:
    Dec 31, 2014
    Posts:
    136
    Hi ! I would like to know if this is working good or I'm doing something wrong.

    I have designed a simple car using physics and wheelcolliders. I'm using a RWD configuration.


    I made a quick GUI text to show up each wheelcollider rpm and the difference between front wheels and rear wheels is quite a lot.



    So, FL / FR / BL / BR correspond to each wheel RPMs.

    At full torque (8000), this are the RPMs :



    As you can see, back wheels reach a maximum of 146k rpms aproximately, while front wheels move around 500-1600 rpms rapidly.


    Am I doing something wrong or did I miss something ?

    By the way, I'm using Unity 5.0.0f4 Personal.

    Thanks in advance.
     
    Last edited: Apr 6, 2015
  2. SnakeTheRipper

    SnakeTheRipper

    Joined:
    Dec 31, 2014
    Posts:
    136
    Can somebody help ?
     
  3. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
  4. SnakeTheRipper

    SnakeTheRipper

    Joined:
    Dec 31, 2014
    Posts:
    136
    Thanks but I can't find any other documentation about WheelCollider.ConfigureVehicleSubsteps().

    Do you know anything else about it ?
     
  5. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    The documentation is missing, but it looks that from the autocomplete, the method has the following signature:

    Code (CSharp):
    1. public void ConfigureVehicleSubsteps (float speedThreshold, int stepsBelowThreshold, int stepsAboveThreshold);
    And from what was said in the post, it looks that the default call is probably ConfigureVehicleSubsteps(5f, 5, 5) and also that one would have to pick a new threshold speed (probably higher than 5 m/s) and stepsBelowThreshold and stepsAboveThreshold greater than 5.
     
    SnakeTheRipper likes this.
  6. SnakeTheRipper

    SnakeTheRipper

    Joined:
    Dec 31, 2014
    Posts:
    136
    Okay, thanks for the help !
     
  7. SnakeTheRipper

    SnakeTheRipper

    Joined:
    Dec 31, 2014
    Posts:
    136
    UPDATE :

    I've lowered the motorTorque down to 800 (from 8000), increased wheels mass to 150 kg and some other tweeks in slip and seems to work nice now.

    RPM's don't go up and down as weird as before, and back wheels RPM's stay at 2000-3000.

    Also updated to Unity 5.0.1f1, maybe they changed something in wheelcolliders.
     
  8. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    Good to hear. I'm currently upgrading to 5.0.1f11.

    I'm actually using a 100kg vehicle with 25kg wheels, which aren't real-world values, yet it seems to work. I've repeatedly asked @yant about this discrepancy in realism and non-real world values, with no answers.

    Interestingly, I've tested ConfigureVehicleSubsteps with different inputs, and observed no changes, so it looks to be another broken aspect of the new vehicle physics.
     
    SnakeTheRipper likes this.
  9. SnakeTheRipper

    SnakeTheRipper

    Joined:
    Dec 31, 2014
    Posts:
    136
    I've been using 25-50 kg wheels and 1000-1500 kg car, didn't achieve good results.
     
  10. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    I've had somewhat better luck with vehicle configurations, including 1000kg vehicles, with Easy Suspension.
     
    SnakeTheRipper likes this.
  11. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    I've e-mailed @yant and copied you on the message, lets hope he can at least try to explain or point us to relevant documentation.
     
    SnakeTheRipper likes this.
  12. SnakeTheRipper

    SnakeTheRipper

    Joined:
    Dec 31, 2014
    Posts:
    136
    Cool ! Thanks dude.
     
  13. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    With a simple air resistance calculation, and a simple transmission system,I have a fairly decent 1000kg vehicle working using Easy Suspension as well as 50kg tires.

    The settings I used are in the e-mail to yant that I copied you on.

    Also, ConfigureVehicleSubsteps (5.0f, 5, 5) seems to work in my case.

    Though I'm still trying to figure out some strange behavior, and why unrealistic amounts of torque are needed for the car to accelerate.
     
  14. SnakeTheRipper

    SnakeTheRipper

    Joined:
    Dec 31, 2014
    Posts:
    136
    Yes, I saw the PMs. I'll check this tomorrow when I reach my desktop computer. Thanks for the research dude !
     
  15. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    Maybe because so massive wheels imply a big inertia and a lot of torque just to modify their spin rate.

    I've also noticed some strange behaviors not only about vehicles but about physics and collisions in general. For instance, impulses as result of the collisions seems not to be applied correctly, so the rigidbody reacts unrealistically.
     
  16. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    In Unity 4, it was possible to apply realistic torque amounts to the wheels of 1000kg vehicle, i.e. 300Nm, but I noticed in Unity 5, with either 25kg or 50kg wheels, an order of at least 10, i.e. 3000Nm of torque is required.

    I've also noticed different results for ray casting in Unity 5.
     
  17. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    The method in Unity 4 was even more doubtful. Torque was translated to Slip using a fixed lineal formula. The friction curve at that Slip results in an acceleration (mass-independent) imposed to the vehicle. So IMHO it was a coincidence that the torque amount were somewhat realistic in that case.

    I haven't noticed anything significant with the raycasts so far. What are your results?
     
  18. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    Interesting, this would explain why the Unity 4 wheel collider didn't respond differently to different rigid body masses.

    I had a simple implementation of a raycast vehicle. The rays seemed to fall through the mesh collider, which never happened in Unity 4, but it might've been an issue with the suspension.
     
  19. SnakeTheRipper

    SnakeTheRipper

    Joined:
    Dec 31, 2014
    Posts:
    136
    By the way, what are you using as Forward Friction/Sideways Friction settings ? I got some cool settings searching on forums which seem to act cool but a bit slippery.

     
  20. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    1:1 seems to work in my case as well, although I'm experimenting with different ways of increasing sideways stiffness at higher speeds.
     
  21. SnakeTheRipper

    SnakeTheRipper

    Joined:
    Dec 31, 2014
    Posts:
    136
    What do you mean 1:1 ? Stiffness values ?
     
  22. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    Yes, and actually, in the case of the 1000kg vehicle, I needed much higher stiffness values.

    I used a forward friction stiffness of 4 and sideways friction stiffness of 5.
     
  23. MuratKul

    MuratKul

    Joined:
    May 23, 2015
    Posts:
    1
    I had the same problem. Decreasing fixed timestep in Time Manager solved it.
     
  24. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    Best way to handle this is remove all motor torque when you reach an rpm limit.

    if(mathf.abs(wheelcollider.rpm) > 1000)
    wheelcollider.motortorque = 0;
     
    electroid likes this.
  25. electroid

    electroid

    Joined:
    Mar 9, 2017
    Posts:
    2
    Nice solution!
     
  26. Domvel

    Domvel

    Joined:
    Sep 18, 2018
    Posts:
    24
    General question: How to bring WheelCollider.rpm to work? The value is flickering between valid value and undefined at most of time.