Facebook Twitter YouTube

Camera::LookInDirection

Defined in:  TSCameras.h
Orients the camera so that it looks in a given direction.
Prototype

void LookInDirection(const Vector3D& direction);

void LookInDirection(const Vector3D& direction, const Vector3D& up);

Parameters
direction The direction in which to look. This must be unit length.
up The general up direction. This must be unit length.
Description
The LookInDirection function modifies a camera's node transform so that the camera looks in the direction given by the direction parameter. The up parameter specifies the general up direction for the camera and defines the vertical plane containing both the direction vector. If the up parameter is parallel to the direction parameter, then the resulting node transform will be singular and subsequent rendering through the camera is undefined.

The direction in which to look should be specified in the camera's local coordinate space. Ordinarily, a camera resides in the infinite zone at the root of a scene, so the camera's local space is world space. In the case that the camera is a subnode of another node having a non-identity world transform, the direction and up parameters must be transformed into the camera's local space using the parent node's inverse world transform.

If the up parameter is omitted, then the direction (0,0,1) is used as the up direction.
See Also

Camera::LookAtPoint

Node::SetNodeTransform