Search Unity

Anisotropic friction?

Discussion in 'Physics' started by kdgalla, Jun 13, 2019.

  1. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    I whimsically imagined putting a little toy car in my game- if you happen to bump into, it'll just roll away. Nothing else to it- just a fun little detail.

    I started with a car asset, put a rigidbody on it and I put a slippery box collider on it as well. When you kick it from behind, it looks very convincing- it slides a few meters down the hall and slows to a stop. You don't really notice that the wheels aren't even moving. :)

    If you kick it from the side it does the same thing sideways, which looks wrong. It would look better if it were to skid a much smaller amount, or even flip over.

    I've read that there used to be such a thing as a physics material with anisotropic friction, which would seem to solve my problem, but NVidia has removed that from the underlying physics engine at some point. Does anyone know of a simple substitute?
     
  2. KouroshX98

    KouroshX98

    Joined:
    Feb 8, 2018
    Posts:
    24
    Does your car use wheel colliders or something else?!
     
  3. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    just a box collider, like I said. Setting up wheel colliders seem like overkill for something so simple.
     
  4. KouroshX98

    KouroshX98

    Joined:
    Feb 8, 2018
    Posts:
    24
    I think you should use wheelcollider.set up a relativly high forward friction.if you want your car to slip sideways lower the sideways friction a bit.modify the spring value for a toy car with mass 5kg use something like 80.apply a brake torque for wheels in script on start function to make it stop after moving a few meters.
     
  5. Bing0Bong0

    Bing0Bong0

    Joined:
    Feb 14, 2018
    Posts:
    4
    Little late but since there is not many solutions for this issue ill post mine for people who are looking. I used compound colliders with different physic materials. Applying it to this issue, you would make one collider that is longer with a physic material with less friction, and one wider with a higher friction physic material. When you collide from the back or front of the car, it would use the low friction collider, and if from the side, the higher friction collider. I used this to solve my player sticking to walls and sliding on the floor.
     
    Last edited: Apr 21, 2020
    kdgalla likes this.
  6. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    Thanks for posting your solution. This is just the sort of simple fix I was hoping to find. I will try it later.