Character Control Tips And Tricks

Character Slow When Rubbing Against Surfaces

  1. If a character is slowed down when running against surfaces then your best bet is to apply a frictionaless material to the character’s collider.

For 2D Friction

  1. Inside your project window create a new physics material by right clicking and selecting Create > 2D > Physics Material 2D.

  2. Inside the material set bounciness to 0 and Friction to 0

  3. Inside your character’s collider, set the physics material to the one you just created.

Orient Characters With The Mouse Position

Here is a quick script that gets you the mouse’s in game position along the x,y plane. It does this by projecting a ray from the camera though the mouse and checks where the ray intersects with the plane. If no intersection occurs it just returns a zero vector.