walking against walls
I'm trying to make a 3D-shooter.
I've already drawn the walls, and I've made a function called
and the same functions for moving backward and strafe right/left.
As you can imagine, the function returns false, if the player is standing in front of a wall, because then h cannot move forward.
The result is, that when I'm walking against a wall in my scene, then my movement stops.
But when I remember some 3D-shooters I've played, the player didn't really stop moving when he was walking against a Wall (if he didn't walk perpendicularly against it), but he changed the direction of his movement (WITHOUT changing the direction of his view).
I've tried out a lot, but don't get a good result.
If you don't understand my question, you can start a 3D shooter (if you have) and walk against a wall (with an angle that is NOT = 90 degrees to the wall). You'll see, thar you don't stop moving when you touch the wall.
Thanks for listening (and answering)
Re: walking against walls
You should have the normal of the wall, if not you can use the cross product to calculate it.
Use the dot product to find the angle between the normal and the player heading, then from there use a bit of trig to find the velocity of the player