C4 Engine
C4 Engine API Documentation

Camera::LookAtPoint

Defined in:  C4Cameras.h
Orients the camera so that it looks at a given point.
Prototype

void LookAtPoint(const Point3D& point);

void LookAtPoint(const Point3D& point, const Vector3D& up);

Parameters
point The point at which to look.
up The general up direction. This must be unit length.
Description
The LookAtPoint function modifies a camera's node transform so that the camera looks directly toward the point given by the point parameter. The up parameter specifies the general up direction for the camera and defines the vertical plane containing both the camera and the point being looked at. If the point parameter coincides with the camera position, or the up parameter is parallel to the difference between the point parameter and the camera position, then the resulting node transform will be singular and subsequent rendering through the camera is undefined.

The point being looked at 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 point 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::LookInDirection

Node::SetNodeTransform