i know i can rotate my model with just tracking how much the mouse has changed but id like to rotate my object exactly where my view vector is looking so my object is looking in the same direction as the view vector
i just learned how to scale and subtract vectors
so i was able to pull my camera back a little and created a chase camera
int i;
vec3_t chaseVec;
for ( i = 0 ; i < 3 ; i++ ) {
chaseVec[i] = newView[i] - newPos[i];
}
VectorNormalize(chaseVec, chaseVec);
VectorScale(chaseVec, 200.0, chaseVec);
VectorSubtract(newPos, chaseVec, newPos);
//dont think i need to set the veiw and up back
//VectorSubtract(newView, chaseVec, newView);
//VectorSubtract(newUp, chaseVec, newUp);
i also initially thot that i would need to pull the view
vector back same distance as position since they are both points not vectors
but this results in the camera going really far back if i go up or down
so i would like to know what the deal with that as well
thx
sorry im such a noob
how do i get rotation degrees from view vector?
Started by enjoycrf, Feb 25 2011 12:29 AM
1 reply to this topic
#1
Posted 25 February 2011 - 12:29 AM
#2
Posted 25 February 2011 - 01:36 AM
ok here it is
i guess i didnt realize that u need an origin vector as well
which is your normalized forward direction vector which remains constant
its like where u were looking at before the mouse started moving
and it was cool to find out that c++ already has an arc tangent function
myAngle = atan2(viewVec[1], viewVec[0]) - atan2(forwardVec[1], forwardVec[0]);
myAngle = RAD2DEG(myAngle);
i guess i didnt realize that u need an origin vector as well
which is your normalized forward direction vector which remains constant
its like where u were looking at before the mouse started moving
and it was cool to find out that c++ already has an arc tangent function
myAngle = atan2(viewVec[1], viewVec[0]) - atan2(forwardVec[1], forwardVec[0]);
myAngle = RAD2DEG(myAngle);
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












