Search Unity

2.5D player movement stuck with walls

Discussion in 'Physics' started by Rubikpotato, Apr 2, 2015.

  1. Rubikpotato

    Rubikpotato

    Joined:
    Dec 25, 2014
    Posts:
    14
    Hi, I'm trying to move a character in a 2.5d game. I'm using 4 box colliders that are in each side of the player to detect if is colliding to a wall and disable movement in that way while mid-air until you reach floor or go to another direction. All was excellent until I made the player rotate always facing to the camera in the y axis. The problem around is that you can avoid "sliding" with walls if you hit the wall with the "corner" of the object, or you constantly rotate when colliding with a wall. How I can make the player fall when hitting with walls no matter the rotation of the object?

    I'm using rigidbody.velocity to move the player. So anybody know how I can solve this issue? I heard about raycasting, but I don't understand raycasting nor how to use it.
     
  2. Rubikpotato

    Rubikpotato

    Joined:
    Dec 25, 2014
    Posts:
    14
    Fixed with a CharacterController.