CPCamera

org.cosplay.CPCamera
open class CPCamera

Camera panning descriptor.

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:

+--------------------------------------------------+
|scene                                             |
|         +-------------------------------+        |
|         |screen/canvas                  |        |
|         |     +--------------------+    |        |
|         |     |focus frame         |    |        |
|         |     |                    |    |        |
|         |     |       o            |    |        |
|         |     |      /|\ tracking  |    |        |
|         |     |      / \ object    |    |        |
|         |     |                    |    |        |
|         |     +--------------------+    |        |
|         |                               |        |
|         +-------------------------------+        |
|                                                  |
+--------------------------------------------------+

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.

Source
CPCamera.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(focusTrackId: String, focusFrameInsets: CPInsets)

Creates camera descriptor.

Creates camera descriptor.

Value parameters

focusFrameInsets

Focus frame defined as insets from screen size.

focusTrackId

ID of the scene object to track the focus for by panning the camera to follow the focus subject.

Attributes

Source
CPCamera.scala

Concrete methods

Gets focus frame as a set of insets from the screen.

Gets focus frame as a set of insets from the screen.

Attributes

Source
CPCamera.scala
def getFocusTrackId: Option[String]

Gets ID of the scene object to be tracked. Returning None will turn off the focus tracking.

Gets ID of the scene object to be tracked. Returning None will turn off the focus tracking.

Attributes

Source
CPCamera.scala
def getPanningStepX: Float

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.

Attributes

Source
CPCamera.scala
def getPanningStepY: Float

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.

Attributes

Source
CPCamera.scala
def isMinPanningX: Boolean

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.

Attributes

Source
CPCamera.scala
def isMinPanningY: Boolean

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.

Attributes

Source
CPCamera.scala
def setFocusFrameInsets(focusFrameInsets: CPInsets): Unit

Sets focus frame as a set of insets for the screen.

Sets focus frame as a set of insets for the screen.

Value parameters

focusFrameInsets

Insets for the screen to defined the focus frame.

Attributes

Source
CPCamera.scala
def setFocusTrackId(focusTrackId: Option[String]): Unit

Sets ID of the scene object to be tracked. Default value is None which turns the focus tracking off.

Sets ID of the scene object to be tracked. Default value is None which turns the focus tracking off.

Value parameters

focusTrackId

ID of the scene object to track the focus for by panning the camera to follow the tracking subject or None to turn the focus tracking off.

Attributes

Source
CPCamera.scala
def setMinPanningX(minPanningX: Boolean): Unit

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.

Attributes

Source
CPCamera.scala
def setMinPanningY(minPanningY: Boolean): Unit

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.

Attributes

Source
CPCamera.scala
def setPanningStepX(panningStepX: Float): Unit

Sets the panning step for X-axis.

Sets the panning step for X-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.

Value parameters

panningStepX

Panning step for X-axis.

Attributes

Source
CPCamera.scala
def setPanningStepY(panningStepY: Float): Unit

Sets the panning step for Y-axis.

Sets the panning step for 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.

Value parameters

panningStepY

Panning step for Y-axis.

Attributes

Source
CPCamera.scala