Original Post
I''ve been having some trouble rotating my camera. It is defined by four vectors (position, up, forward, and right; where up, forward, and right are relative to position).
I want to be able to modify the camera''s yaw, pitch, and roll. I initially wanted to simply pass an angle into a function and create a transformation matrix based on this angle, but I couldn''t get this to work at all (for not enough understanding/practice in matrix math).
Next I tried to also store 3 floats - r, p, and y (for roll, pitch, yaw). Then I update my three vectors based on trig of a unit circle. Thus:
float Camera:This code goes haywire - the vectors arent calculated correctly. What am I doing wrong - or, could I have a few tips on the first method? -- Dustinitch(float angle) { p+=angle; update(); } float Camera::yaw... float Camera::roll... float Camera::update() { forward.x = cos(y); forward.y = sin(p); forward.z = sin(y); right.x = cos(p+pi/2); right.y = sin(r); right.z = sin(p+pi/2); up=CrossProduct(forward, right); }