Class cocos.actions.camera_actions.OrbitCamera

    base_actions.Action --+        
                          |        
base_actions.IntervalAction --+    
                              |    
                 Camera3DAction --+
                                  |
                                 OrbitCamera
Orbits the camera around the center of the screen using spherical coordinates

Methods

  init(self, radius=None, delta_radius=0, angle_z=None, delta_z=0, angle_x=None, delta_x=0, *args, **kw)
Initialize the camera with spherical coordinates
  start(self)
External code sets self.target and then calls this method.
( radius, zenith, azimuth ) get_spherical_coords(self)
returns the spherical coordinates from a cartesian coordinates
  update(self, t)
Gets called on every frame 't' is the time elapsed normalized to [0, 1] If this action takes 5 seconds to execute, t will be equal to 0 at 0 seconds.
  __add__(self, action)
sequence operator - concatenates actions action1 + action2 -> action_result where action_result performs as: first do all that action1 would do; then perform all that action2 would do
(Inherited from cocos.actions.base_actions.Action)
  __init__(self, *args, **kwargs)
dont override - use init
(Inherited from cocos.actions.base_actions.Action)
  __mul__(self, other)
repeats ntimes the action action * n -> action_result where action result performs as: repeat n times the changes that action would do
(Inherited from cocos.actions.base_actions.IntervalAction)
  __or__(self, action)
spawn operator - runs two actions in parallel action1 | action2 -> action_result
(Inherited from cocos.actions.base_actions.Action)
  __reversed__(self) (Inherited from cocos.actions.camera_actions.Camera3DAction)
  done(self)
When in the worker role, this method is reliable.
(Inherited from cocos.actions.base_actions.IntervalAction)
  step(self, dt)
Dont customize this method: it will not be called when in the component role for certain composite actions (like Sequence_IntervalAction).
(Inherited from cocos.actions.base_actions.IntervalAction)
  stop(self)
When the action must cease to perform this function is called by external code; after this call no other method should be called.
(Inherited from cocos.actions.base_actions.Action)

Instance Variables

  target
CocosNode object that is the target of the action
(Inherited from cocos.actions.base_actions.Action)

Method Details

init

init(self, radius=None, delta_radius=0, angle_z=None, delta_z=0, angle_x=None, delta_x=0, *args, **kw)

Initialize the camera with spherical coordinates

For more information regarding spherical coordinates, read this:
http://en.wikipedia.org/wiki/Spherical_coordinates
Parameters:
radius : float
Radius of the orbit. Default: current radius
delta_radius : float
Delta movement of the radius. Default: 0
angle_z : float
The zenith angle of the spherical coordinate in degrees. Default: current
delta_z : float
Relative movement of the zenith angle. Default: 0
angle_x : float
The azimuth angle of the spherical coordinate in degrees. Default: 0
delta_x : float
Relative movement of the azimuth angle. Default: 0
Overrides:
Camera3DAction.init

start

start(self)
External code sets self.target and then calls this method. Perform here any extra initialization needed.
Overrides:
Camera3DAction.start

get_spherical_coords

get_spherical_coords(self)

returns the spherical coordinates from a cartesian coordinates

using this formula:

Returns: ( radius, zenith, azimuth )

update

update(self, t)
Gets called on every frame 't' is the time elapsed normalized to [0, 1] If this action takes 5 seconds to execute, t will be equal to 0 at 0 seconds. t will be 0.5 at 2.5 seconds and t will be 1 at 5sec. This method must not use self._elapsed, which is not guaranted to be updated.
Overrides:
base_actions.IntervalAction.update