I use 1 pivot to represent the players feet and only apply yaw to this pivot.
The camera is parented to this pivot and only pitch is applied to the camera for looking up and down.
When the player moves forward it is the 'feet' pivot that is moved, the camera will follow because of the parenting but the camera's pitch will not make the player move up and down.
[Edit] yes thats it...you sneaked the second post in before me ;)
You can also now have a variable which describes how high above the feet pivot the camera is and when the player crouches or stands up, move the camera nearer or farther away from the feet pivot to simulate this.
Also when the player is moving up/down stairs you can modify this 'feet to camera' distance to make the camera smoothly fly on the stairs instead of bumping up/down at each step.
The camera is parented to this pivot and only pitch is applied to the camera for looking up and down.
When the player moves forward it is the 'feet' pivot that is moved, the camera will follow because of the parenting but the camera's pitch will not make the player move up and down.
[Edit] yes thats it...you sneaked the second post in before me ;)
You can also now have a variable which describes how high above the feet pivot the camera is and when the player crouches or stands up, move the camera nearer or farther away from the feet pivot to simulate this.
Also when the player is moving up/down stairs you can modify this 'feet to camera' distance to make the camera smoothly fly on the stairs instead of bumping up/down at each step.