Update of /cvsroot/epfl/tggame
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22708
Modified Files:
controller.cc playercontroller.cc
Log Message:
camera quaternion devermine
Index: playercontroller.cc
===================================================================
RCS file: /cvsroot/epfl/tggame/playercontroller.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** playercontroller.cc 28 Oct 2004 21:20:33 -0000 1.9
--- playercontroller.cc 30 Oct 2004 17:46:47 -0000 1.10
***************
*** 26,41 ****
//Vector3 mRot(0,0,0);
! //Quaternion roty (((float)mX-middleX)*6*fSensivity, 0,1,0);
! //Quaternion rotx (((float)mY-middleY)*6*fSensivity, 1,0,0);
! ry += ((float)mX-middleX)*6*fSensivity;
! rx += ((float)mY-middleY)*6*fSensivity;
Game::pSelf->GetEngine()->WarpMouse(middleX,middleY);
! //pPawn->SetRotation(pPawn->GetRotation()+mRot);
! //pPawn->SetRotation(pPawn->GetRotation()*roty*rotx);
! Quaternion q;
! q.FromEuler(rx, ry, 0);
q.Normalize();
pPawn->SetRotation(q);
}
--- 26,42 ----
//Vector3 mRot(0,0,0);
! ry -= ((float)mX-middleX)*6*fSensivity;
! rx -= ((float)mY-middleY)*6*fSensivity;
Game::pSelf->GetEngine()->WarpMouse(middleX,middleY);
! Quaternion qY = Quaternion(ry, Vector3(0,1,0));
! Quaternion qX = Quaternion(rx, Vector3(1,0,0));
! Quaternion q = qY*qX;
q.Normalize();
+
+ /*Quaternion q;
+ q.FromEuler(rx, ry, 0);
+ q.Normalize();*/
pPawn->SetRotation(q);
}
Index: controller.cc
===================================================================
RCS file: /cvsroot/epfl/tggame/controller.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** controller.cc 28 Oct 2004 21:20:33 -0000 1.7
--- controller.cc 30 Oct 2004 17:46:47 -0000 1.8
***************
*** 22,25 ****
--- 22,26 ----
//Vector3 rot = pPawn->GetRotation();
Quaternion rot = pPawn->GetRotation();
+ //std::cout << rot << std::endl;
vLastVel.Null();
***************
*** 49,59 ****
z = rot.GetZAxis();
if (bDir[0])
! vLastVel = vVelocity += x*fSpeed;
if (bDir[1])
- vLastVel = vVelocity -= x*fSpeed;
- if (bDir[2])
vLastVel = vVelocity += z*fSpeed;
if (bDir[3])
! vLastVel = vVelocity -= z*fSpeed;
pPawn->SetVelocity(pPawn->GetVelocity()+vVelocity);
--- 50,60 ----
z = rot.GetZAxis();
if (bDir[0])
! vLastVel = vVelocity -= z*fSpeed;
if (bDir[1])
vLastVel = vVelocity += z*fSpeed;
+ if (bDir[2])
+ vLastVel = vVelocity -= x*fSpeed;
if (bDir[3])
! vLastVel = vVelocity += x*fSpeed;
pPawn->SetVelocity(pPawn->GetVelocity()+vVelocity);
|