Hello friends,

I've tried to connect the camera from the book to an Ogre camera, this's what I got so far

Ogre::Vector3 BourneVec3ToOgreVec3(Dolly_Cam::Vector3 vec) {
Ogre::Vector3 vec3;
vec3.x = vec.x;
vec3.y = vec.y;
vec3.z = vec.z;
return vec3;
}
Dolly_Cam::Vector3 OgreVec3ToBourneVec3(Ogre::Vector3 vec) {
Dolly_Cam::Vector3 vec3;
vec3.x = vec.x;
vec3.y = vec.y;
vec3.z = vec.z;
return vec3;
}

cam.mvPosition = OgreVec3ToBourneVec3(mSceneMgr->getSceneNode("Worker00001Node")->getPosition() + Ogre::Vector3(0, 5, 5));
cam.mvFacing = cam.mvPosition - OgreVec3ToBourneVec3(mSceneMgr->getSceneNode("Worker00001Node")->getPosition());
changeDollyCam(cam);

void OgreRecastApplication::changeDollyCam(const Dolly_Cam::Camera& cam) {
Ogre::Camera* camera = mSceneMgr->createCamera("Dolly_Cam");
mWindow->removeViewport(0);
camera->setPosition(BourneVec3ToOgreVec3(cam.mvPosition));
camera->lookAt(BourneVec3ToOgreVec3(cam.mvView));
Ogre::Radian R = Ogre::Math::ATan(Ogre::Math::Tan(Ogre::Degree((float)45/2))/mCamera->getAspectRatio())*2;
camera->setFOVy(R);
mViewport = mWindow->addViewport( camera );
mViewport->setCamera(camera);
delete mCameraMan;
mCameraMan = new OgreBites::SdkCameraMan(camera);
}

But it looks perhaps at the opposite direction. But I have tried to reverse the order of subtraction to no avail.

To my understanding of vectors, the look at vector should be camera's position substracting the position of look at target.

Correct me if I am any wrong.

Update:

Notice I've got a typo for mCamera => camera in addViewport line, but the result is same

Thanks

Jack

**Edited by lucky6969b, 26 July 2014 - 06:36 AM.**