views:

59

answers:

1

alt text

I'm making an isometric game. When the player tries to walk diagonally into a wall I want them to slide smoothly across it, so whatever portion of the movement would be legal is used, and anything in the direction of the normal is thrown away. Walls can be any angle, not just vertical or horizontal, and the player has 360 motion.

I feel like I'm almost there but I can't put the last piece into place.

+4  A: 

I believe what you want to do is project the input direction parallel to the wall.

Vector Projection would be the way to do this.

Example, when you detect collision with the wall, check the projection vector of the input along the parallel vector to the wall. If it is non-zero, replace the input vector with the projected vector.

Marc Reside