Camera tracking is the process by which the game engine automatically focuses on a particular scene object and tracks its movement across screen keeping so that it stays in focus. Without camera tracking a scene object could move outside the visible screen and become invisible.
Camera descriptor defines a rectangular sub-region of the screen called focus frame. A tracking object can move freely as long as it is fully contained in that focus frame. Once the tracking object (at least partially) moves outside the focus frame, the focus frame and therefore the visible portion of the current scene will shift to bring the tracking object back into the focus frame. The amount of shift as well as its velocity is also controlled by this descriptor:
Camera control is a property of scene and available via CPScene.getCamera method. The camera descriptor is a mutable object. Once obtained via CPScene.getCamera method you can configure it. Note that the default camera descriptor returned by the scene is not configured for tracking.
Attributes
Example
See CPCameraExample class for the example of using camera.
Gets panning step for X-axis defining how fast the camera focus will catch up with tracking object that is outside the camera frame. Value of 1.0f (default) usually provides the smoothest panning animation.
Gets panning step for X-axis defining how fast the camera focus will catch up with tracking object that is outside the camera frame. Value of 1.0f (default) usually provides the smoothest panning animation.
Note that if tracking object moves faster than the panning of the camera it can move outside the visible screen.
Gets panning step for Y-axis defining how fast the camera focus will catch up with tracking object that is outside the camera frame. Value of 1.0f (default) usually provides the smoothest panning animation.
Gets panning step for Y-axis defining how fast the camera focus will catch up with tracking object that is outside the camera frame. Value of 1.0f (default) usually provides the smoothest panning animation.
Note that if tracking object moves faster than the panning of the camera it can move outside the visible screen.
Tests whether camera panning will return tracking object into the center of the focus frame along X-axis or just minimally inside. Default value is true.
Tests whether camera panning will return tracking object into the center of the focus frame along X-axis or just minimally inside. Default value is true.
Tests whether camera panning will return tracking object into the center of the focus frame along Y-axis or just minimally inside. Default value is true.
Tests whether camera panning will return tracking object into the center of the focus frame along Y-axis or just minimally inside. Default value is true.
Sets whether camera panning will return tracking object into the center of the focus frame along X-axis or just minimally inside. Default value is true.
Sets whether camera panning will return tracking object into the center of the focus frame along X-axis or just minimally inside. Default value is true.
Value parameters
minPanningX
Whether or not to return tracking object to the center of the focus frame along X-axis.
Sets whether camera panning will return tracking object into the center of the focus frame along Y-axis or just minimally inside. Default value is true.
Sets whether camera panning will return tracking object into the center of the focus frame along Y-axis or just minimally inside. Default value is true.
Value parameters
minPanningY
Whether or not to return tracking object to the center of the focus frame along Y-axis.
Panning step defines how fast the camera focus will catch up with tracking object that is outside the camera frame. Value of 1.0f (default) usually provides the smoothest panning animation.
Note that if tracking object moves faster than the panning of the camera it can move outside the visible screen.
Panning step defines how fast the camera focus will catch up with tracking object that is outside the camera frame. Value of 1.0f (default) usually provides the smoothest panning animation.
Note that if tracking object moves faster than the panning of the camera it can move outside the visible screen.