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

Wheel Collider Random slip spikes over 5ms (Video) Unity 2017.1

Discussion in 'Physics' started by sh0v0r, Jul 16, 2017.

  1. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    325
    Exceeding 5ms Magnitude causes strange random Wheel Collider friction spikes.

    Unity 2017.1 Default values.

    I was adding wheel slip FX, tyre smoke, skid marks, sound and came across this odd issue which I think is a bug since it starts occurring exactly when the Rigidbody is at 5ms+ which seems like some hard coded internal value.

    Nothing I tried would fix it, I believe this is an engine bug.

    In the following video pay attention to the 'Mag' value when it is above and below 5ms and how the wheel behaves. I added the white bar to the wheel to contrast the wheel pose behaviour so its more visible.

    In the top left are wheel slip limit values, they highlight erratic nature of the forward friction.

     
    Last edited: Jul 16, 2017
  2. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    325
    I tested this in 5.6.1p4 and initially the issue went away, but after saving the scene and working for a few moments it started happening again.

    Does Unity use the NVidia GPU at at all to process the physics, could it be a driver issue?
     
    Last edited: Jul 17, 2017
  3. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    325
    I have sold this problem.

    Its the Vehicles Rigidbody interpolation, it needs to be set at runtime.

    We had a similar problem with Ragdolls in another project which we discovered. The ragdolls would have very odd dislocation of joints and the fix was to set the Rigidbody interpolation on in Start() rather than being set in the inspector.
     
  4. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    325
    Another follow up, seems to actually be more related to the Wheel mass, I increased the Wheel mass from the default 20 upto 35 and the issue stopped.

    The wheels on my Jeep have a radius of 0.6 up from the default of 0.5, I wonder if increasing the radius should imply a heavier wheel which is being factored into the sprung mass calculation?

    Looking at the PhysX docs the Wheel Damping Rate is not listed but when configuring the wheel in code there is a value for MOI Moment Of Inertia.

    http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/guide/Manual/Vehicles.html
     
  5. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    Unity doesn't use the GPU to process the physics. It's always done at the CPU.
     
  6. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    325
    Cheers Edy, I had a hunch that was the case but you never know.

    Have you by chance notice this issue at all, you've done a lot of vehicle stuff right?

    Does seem to be something you need to 'tune around' to avoid.

    I've been developing a light weight system for a new mobile game I'm working on.

     
  7. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    I've re-read your post and yes, that issue may surely be resolved with the vehicle substeps:

    https://docs.unity3d.com/ScriptReference/WheelCollider.ConfigureVehicleSubsteps.html

    If I recall correctly, the default parameters are 5, 3, 1. This is why the behavior changes above 5 m/s. Setting the substeps to 5, 3, 3 (assuming 3 is the default substep value, I'm not entirely sure) would give you the same behavior at all speeds.
     
    Bunny23Rabbit likes this.