   Basic collision detection
  Hi! I'm making my first 3D game. I like to restrain the player in a certain area. What I'm doing right now is:if(playerPosZ < 6.0 && playerPosZ > -6.0) { move() }...The problem is, that you begin to glide when you move towards a wall in an angle. My friend say this is a common problem, but still I cant find any information about it neither here nor using Google.Daniel Lännström   
  My guess would be that you need to move them back the direction they came from and are most likely moving them perpendicular to the wall instead. That gives them a movement parallel to the wall. Say you have a wall at x=0. The player is at (5,0) and moves by (-10,10) which would put them at (-5,10). They can't move through the wall though so you move them by (5,0) to (0,10). The result is they logically move from (5,0) to (0,5) to (0,10), i.e. they slide along the wall by 5 units. Instead when they were found to be at (-5,10) they should have been moved by -0.5*(-10,10)=(5,-5) so they end up at (0,5), i.e. they got stopped by the wall.   ;  Yeah, you are so right.   