cocos.camera module — cocos v0.6.5 documentation

# cocos.camera module

Camera object

class `Camera`

  Bases: `object`

  Camera used in every CocosNode. Useful to look at the object from different views. The OpenGL gluLookAt() function is used to locate the camera.

  If the object is transformed by any of the scale, rotation or position attributes, then they will override the camera.

  classmethod `get_z_eye`()

    Returns the best distance for the camera for the current window size

    cocos2d uses a Filed Of View (fov) of 60

  `locate`(force=False)

    Sets the camera using gluLookAt using its eye, center and up_vector

    Parameters: | force : bool whether or not the camera will be located even if it is not dirty

  `restore`()

    Restore the camera to the initial position and sets it’s `dirty` attribute in False and `once` in true.

    If you use the camera, for a while and you want to stop using it call this method.

  `center`

    Center of the camera in x,y,z coordinates

    Type: | float,float,float

  `eye`

    Eye of the camera in x,y,z coordinates

    Type: | float,float,float

  `up_vector`

    Up vector of the camera in x,y,z coordinates

    Type: | float,float,float