MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / getCameraViewTarget

Method getCameraViewTarget

source/camera/CameraManager.cpp:408–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

406}
407
408Ogre::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
430void CameraManager::resetCamera(const Ogre::Vector3& position, const Ogre::Vector3& rotation)
431{

Callers 3

updateMethod · 0.45
handleHotkeysMethod · 0.45
handleHotkeysMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected