I forgot to mention, it's very possible that the up and forward vectors will not be orthonogonal to each other. So, here's what you can do...
camera.forward = player.forward camera.right = wall.normal CROSS camera.forward camera.right.Normalize(); camera.up = camera.forward CROSS camera.right camera.position = player.position + camera.up * EYE_HEIGHT This will make the camera "stick" to the wall and still be able rotate around freely. Though it will work as long as the camera isn't attempting to look directly parallel in the direction of the wall normal. On Thu, 6 Jan 2005 17:43:41 -0800, Trauts <[EMAIL PROTECTED]> wrote: > Actually, I found it. View.cpp > > Message: 3 > Date: Thu, 6 Jan 2005 01:00:01 -0800 > From: David Byttow <[EMAIL PROTECTED]> > To: [email protected] > Subject: Re: [hlcoders] Rotating the view angles (roll?) > Reply-To: [email protected] > > Simply build the camera matrix directly. > > You can build forward, up and right from just the "up" vector. The up > vector will be the normal of the wall and the "forward" vector will be > the direction the player is facing. To get the "right" vector, just > take the cross product of "up" CROSS "forward". Now you have the 3 > basis vectors for the camera. And the position is some offset from the > wall. Perhaps the point on the wall w/ some offset from the "up" > vector. > > Here's the math: > > camera.forward = player.forward > camera.up = wall.normal > camera.right = camera.up CROSS camera.forward > camera.position = player.position + wall.normal * EYE_HEIGHT > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

