Changeset 107 in flair-src for trunk/lib/FlairSimulator


Ignore:
Timestamp:
11/03/16 11:11:54 (7 years ago)
Author:
Sanahuja Guillaume
Message:

m

Location:
trunk/lib/FlairSimulator/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSimulator/src/FixedCamera.cpp

    r87 r107  
    4343  camera->setPosition(vector3df(ToIrrlichtCoordinates(position)));
    4444  camera->setTarget(vector3df(ToIrrlichtCoordinates(lookat)));
     45  target=vector3df(ToIrrlichtCoordinates(lookat));
    4546  init=false;
    4647  rotation=camera->getRotation();
     
    6263  ICameraSceneNode *camera = static_cast<ICameraSceneNode *>(node);
    6364  vector3df newRotation=rotation;
     65  vector3df newTarget=target;
    6466
    6567if(init==false) {
     
    7678      Rotating = true;
    7779      //nRotY = rotation.Y;
    78       nRotZ = rotation.Z;
     80      //nRotZ =0;// rotation.Z;
    7981    } else {
    8082      nRotY = (RotateStart.Y - MousePos.Y) * rotateSpeed;
    81       nRotZ += (RotateStart.X - MousePos.X) * rotateSpeed;
     83      nRotZ = (RotateStart.X - MousePos.X) * rotateSpeed;
    8284      newRotation.rotateXZBy(-nRotY);
    8385      //nRotY = sat(nRotY);
     86
     87      //newTarget.rotateXZBy(-nRotY,camera->getPosition());
     88      newTarget.rotateXYBy( nRotZ,camera->getPosition());
     89      camera->setTarget(newTarget);
    8490    }
    8591  } else if (Rotating) {
     
    8894    //rotation.Y = sat(rotation.Y);
    8995    //nRotY = rotation.Y;
    90     nRotZ = rotation.Z;
     96    //nRotZ = rotation.Z;
    9197    Rotating = false;
     98    target=camera->getTarget();
     99    rotation=camera->getRotation();
     100  printf("%f %f %f\n",rotation.X,rotation.Y,rotation.Z);
    92101  }
    93102
     
    102111  }
    103112
    104 
     113//newTarget.rotateXZBy(-nRotY,camera->getPosition());
     114//  newTarget.rotateXYBy( nRotZ,camera->getPosition());
    105115
    106116  //camera->setRotation(vector3df(rotation.X,-180-nRotY,nRotZ));
    107117  //camera->setRotation(vector3df(rotation.X,nRotY,0));
    108118  //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);
    111121  //rotation=camera->getRotation();
    112122  //printf("%f %f %f\n",rotation.X,rotation.Y,rotation.Z);
  • trunk/lib/FlairSimulator/src/FixedCamera.h

    r87 r107  
    3434  float sat(float value);
    3535  irr::core::position2df RotateStart;
    36   irr::core::vector3df rotation;
     36  irr::core::vector3df rotation,target;
    3737  bool Rotating;
    3838  float rotateSpeed;
Note: See TracChangeset for help on using the changeset viewer.