Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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.