| 406 | } |
| 407 | |
| 408 | Ogre::Vector3 CameraManager::getCameraViewTarget() const |
| 409 | { |
| 410 | // Get the position of the camera and direction that the camera is facing. |
| 411 | Ogre::Vector3 position = mActiveCamera->getRealPosition(); |
| 412 | Ogre::Vector3 viewDirection = mActiveCamera->getDerivedDirection(); |
| 413 | |
| 414 | // Compute the offset, this is how far you would move in the x-y plane if |
| 415 | // you follow along the view direction vector until you get to z = 0. |
| 416 | viewDirection.normalise(); |
| 417 | viewDirection /= fabs(viewDirection.z); |
| 418 | Ogre::Vector3 offset = position.z * viewDirection; |
| 419 | offset.z = 0.0; |
| 420 | |
| 421 | // The location we are looking at is then simply the camera's position plus |
| 422 | // the view offset computed above. We zero the z-value on the target for |
| 423 | // consistency. |
| 424 | Ogre::Vector3 target = position + offset; |
| 425 | target.z = 0.0; |
| 426 | |
| 427 | return target; |
| 428 | } |
| 429 | |
| 430 | void CameraManager::resetCamera(const Ogre::Vector3& position, const Ogre::Vector3& rotation) |
| 431 | { |
no outgoing calls
no test coverage detected