Search Unity

Remove the friction of a character controller.

Discussion in 'Physics' started by BwareStudio, Mar 3, 2019.

  1. BwareStudio

    BwareStudio

    Joined:
    Feb 27, 2019
    Posts:
    1
    Hi, I'm making a game and I need your help about moving the character using a character controller. I'm doing a side scroll game but in 3D so I need to block the movement in Z axis. A problem using the character controller is how can I remove the friction, I need this because if the character collides with an object the friction makes him move above the Z axis.
    Another option is use a rigid body, but I think it has cons.
    What can I do?

    Thanks!
     
  2. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    If your game has a lot of character vs rigidbody collisions then I'd suggest using a rigidbody for the character.

    The character controller is designed to climb up 'steps' so if the character collides with an object less high than the step hight defined on the character controller component then they will climb it (pop up on top of it).

    A rigidbody will also have some odd effects but you can lock the Z axis if you don't want it to move in that direction. however doing so can result in the rigidbody pushing through objects in some situations. Both methods have pros and cons, the questions is which are you willing to live with. Try them both, experiment until you get it to work how you like.