Changeset 107 in flair-src for trunk/lib/FlairSimulator
- Timestamp:
- Nov 3, 2016, 11:11:54 AM (8 years ago)
- Location:
- trunk/lib/FlairSimulator/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSimulator/src/FixedCamera.cpp
r87 r107 43 43 camera->setPosition(vector3df(ToIrrlichtCoordinates(position))); 44 44 camera->setTarget(vector3df(ToIrrlichtCoordinates(lookat))); 45 target=vector3df(ToIrrlichtCoordinates(lookat)); 45 46 init=false; 46 47 rotation=camera->getRotation(); … … 62 63 ICameraSceneNode *camera = static_cast<ICameraSceneNode *>(node); 63 64 vector3df newRotation=rotation; 65 vector3df newTarget=target; 64 66 65 67 if(init==false) { … … 76 78 Rotating = true; 77 79 //nRotY = rotation.Y; 78 nRotZ =rotation.Z;80 //nRotZ =0;// rotation.Z; 79 81 } else { 80 82 nRotY = (RotateStart.Y - MousePos.Y) * rotateSpeed; 81 nRotZ += (RotateStart.X - MousePos.X) * rotateSpeed;83 nRotZ = (RotateStart.X - MousePos.X) * rotateSpeed; 82 84 newRotation.rotateXZBy(-nRotY); 83 85 //nRotY = sat(nRotY); 86 87 //newTarget.rotateXZBy(-nRotY,camera->getPosition()); 88 newTarget.rotateXYBy( nRotZ,camera->getPosition()); 89 camera->setTarget(newTarget); 84 90 } 85 91 } else if (Rotating) { … … 88 94 //rotation.Y = sat(rotation.Y); 89 95 //nRotY = rotation.Y; 90 nRotZ = rotation.Z;96 //nRotZ = rotation.Z; 91 97 Rotating = false; 98 target=camera->getTarget(); 99 rotation=camera->getRotation(); 100 printf("%f %f %f\n",rotation.X,rotation.Y,rotation.Z); 92 101 } 93 102 … … 102 111 } 103 112 104 113 //newTarget.rotateXZBy(-nRotY,camera->getPosition()); 114 // newTarget.rotateXYBy( nRotZ,camera->getPosition()); 105 115 106 116 //camera->setRotation(vector3df(rotation.X,-180-nRotY,nRotZ)); 107 117 //camera->setRotation(vector3df(rotation.X,nRotY,0)); 108 118 //camera->bindTargetAndRotation(true); 109 camera->setRotation(rotation);110 //camera->setTarget(vector3df(ToIrrlichtCoordinates(core::Vector3D(0,0,-2))));119 // camera->setRotation(rotation); 120 // camera->setTarget(newTarget); 111 121 //rotation=camera->getRotation(); 112 122 //printf("%f %f %f\n",rotation.X,rotation.Y,rotation.Z); -
trunk/lib/FlairSimulator/src/FixedCamera.h
r87 r107 34 34 float sat(float value); 35 35 irr::core::position2df RotateStart; 36 irr::core::vector3df rotation ;36 irr::core::vector3df rotation,target; 37 37 bool Rotating; 38 38 float rotateSpeed;
Note:
See TracChangeset
for help on using the changeset viewer.