Search Unity

Friction Combination

Discussion in 'Scripting' started by timsk, Jan 20, 2014.

  1. timsk

    timsk

    Joined:
    May 27, 2011
    Posts:
    177
    Hi everyone,

    So I've been having some trouble with my players movement and I can't figure out why it's behaving this way.

    The situation is basically: The player is a sphere, he is moved via RigidBody.AddForce();, the level is made out of individual cubes (size 1,1,1) to make a larger area. Each cube has an individual collider (this has to be the case, as the core mechanic relies on each cube having a 'passable' state).

    Now, everything works fine with this, except when the player is rolling directly on the seam of 2 cubes, his speed is halved. It seems to be combining the friction from the 2 surfaces. The strange thing is that both the player and the cubes have a custom physics material which has the friction combine mode set to "Minimum".

    Is this intended behaviour? The description for the friction combine mode Minimum seems to suggest that it should take the minimum friction value, rather than combine them.

    This feels like a bug, if it's not, does anyone have any ideas for a solution?

    Thanks!
     
  2. TheShane

    TheShane

    Joined:
    May 26, 2013
    Posts:
    136
    Friction combination is for the pair of colliding objects only. I do not think it changes how friction is combined for multiple objects that one object is hitting.

    I would check to make sure the alignment of all the colliders is perfect. If it is a bit off, maybe there is some extra collision happening with the lip of the cubes that slows the ball down?
     
  3. timsk

    timsk

    Joined:
    May 27, 2011
    Posts:
    177
    My cubes are placed perfectly aligned, think of how the cubes in minecraft are placed (my levels have no height tho).

    After chatting with a mate, I've got a possible solution. I'm going to place a plane atop the entire level to act as a floor, this way their won't be any seams.

    I would still be interested in knowing if it's possible to set a "Maximum Friction" for objects, any ideas on that?
     
unityunity