Yes I had already implemented rotating the view vector and camera position (third person) as well as the actual model about the y axis. Obviously this involves both radians and degrees (radians for rotating the views, degrees for rotating the model). Plus we are doing radians heavily in math right now, so I'm really all set with that
I am trying to plug this into code. I have been trying to get this working for 40 mins or so but this just does not work. Is there any problem with order here? Should I add any parenthesis anywhere? This really should be working, but it doesn't.
Code:
Dir = View - Position; //this is the direction
RotDir.x = (Dir.x * cosYTheta) + (Dir.y * sinYTheta * sinXTheta) + (Dir.z * sinYTheta * cosXTheta);
RotDir.y = (Dir.y * cosXTheta) - (Dir.z * sinXTheta);
RotDir.z = (Dir.x * -sinYTheta) + (Dir.y * cosYTheta * sinXTheta) + (Dir.z * cosYTheta * cosXTheta);
EDIT: this is how I derived the number of degrees and radians to perform the rotations. Everything worked for rotations about just the Y axis.
Code:
YRotation += ((360 * XDeviation) / SCREEN_WIDTH);
XRotation += ((360 * YDeviation) / SCREEN_WIDTH);
float YDeviation = (MiddleY - MousePos.y) / 2;
float XDeviation = (MiddleX - MousePos.x) / 2;
float XDegRad = ((2 * PI) * XDeviation) / SCREEN_WIDTH;
float YDegRad = ((2 * PI) * YDeviation) / SCREEN_WIDTH;
float cosXTheta = (float)cos(XDegRad);
float sinXTheta = (float)sin(XDegRad);
float cosYTheta = (float)cos(YDegRad);
float sinYTheta = (float)sin(YDegRad);