Packageflare.core
Classpublic class Camera3D
InheritanceCamera3D Inheritance Pivot3D Inheritance flash.events.EventDispatcher

The Camera3D class represents the point of view and orientation of the scene.

There can be as many cameras as required, but the one selected in the scene will do the rendering.

See also

Scene3D camera


Public Properties
 PropertyDefined By
 InheritedanimationEnabled : Boolean = true
Activates or deactivates the animation.
Pivot3D
 InheritedanimationSmoothMode : int = 2
Sets or gets the animation method used to interpolate between frames.
Pivot3D
  aspectRatio : Number
Sets or returns the aspect ratio of the camera.
Camera3D
  canvasSize : Point
Defines the projection area for the camera viewPort.
Camera3D
 InheritedcastShadows : Boolean = true
Gets or sets if the object should cast shadows.
Pivot3D
 Inheritedchildren : Vector.<Pivot3D>
[read-only] Returns a Pivot3D-type vector with its children.
Pivot3D
  clipRectangle : Boolean = true
Defines if the viewPort clip all pixels outside the viewPort.
Camera3D
 Inheritedcollider : Collider
Pivot3D
 Inheritedcomponents : Vector.<IComponent>
A collection vector that contains all the components of the object.
Pivot3D
 InheritedcurrentFrame : Number
Returns or sets the frame number where the pivot is situated.
Pivot3D
 InheritedcurrentLabel : Label3D
[read-only]
Pivot3D
 Inheriteddirty : Boolean = true
Gets or sets when the object has changed his transform matrix by hand.
Pivot3D
  far : Number
Sets or returns the furthest clip plane from the camera.
Camera3D
  fieldOfView : Number
Sets and returns the camera’s angle of view.
Camera3D
  fovMode : int = 0
Defines whatever fov mode should be used to calculate the projection matrix.
Camera3D
 Inheritedframes : Vector.<Frame3D>
Vector that contains all the animation frames.
Pivot3D
 InheritedframeSpeed : Number
Returns or sets animation speed.
Pivot3D
  frustum : Vector.<Number>
[read-only]
Camera3D
 InheritedinView : Boolean
[read-only]
Pivot3D
 InheritedinvWorld : Matrix3D
[read-only] Returns a matrix with the inverse global position, rotation and scale of the object.
Pivot3D
 InheritedisPlaying : Boolean
[read-only] Returns true if an animation is being played.
Pivot3D
 InheritedisStatic : Boolean
Pivot3D
 Inheritedlabels : Object
Returns or sets an object that contains the Labels3D objects used to play and manage animations.
Pivot3D
 Inheritedlayer : int = 0
Gets or sets the layer to render the object.
Pivot3D
 Inheritedlock : Boolean
Sets the pivot lock mode.
Pivot3D
 Inheritedname : String
Sets or returns the object name.
Pivot3D
  near : Number
Sets or returns the clip plane that is closest to the camera.
Camera3D
  orthographic : Boolean = false
Camera3D
 Inheritedparent : Pivot3D
Returns or sets the object’s parent.
Pivot3D
 Inheritedpriority : int = 0
This value is for internal use to calculate the priority acording the distance from the camera during the render.
Pivot3D
  projection : Matrix3D
Returns the projection matrix.
Camera3D
 InheritedreceiveShadows : Boolean = true
Gets or sets if the object should receive shadows.
Pivot3D
 InheritedscaleX : Number
Increases or decreases the object scale on the X axis from its current scale.
Pivot3D
 InheritedscaleY : Number
Increases or decreases the object scale on the Y axis from its current scale.
Pivot3D
 InheritedscaleZ : Number
Increases or decreases the object scale on the Z axis from its current scale.
Pivot3D
 Inheritedscene : Scene3D
[read-only] Gets a reference to the scene that contains the object.
Pivot3D
 InheritedsortMode : int
Gets ot sets the sorting mode for the object.
Pivot3D
 Inheritedtransform : Matrix3D
Sets or returns the matrix of local position, rotation and scale.
Pivot3D
 Inheritedupdatable : Boolean
Pivot3D
 InheriteduserData : Object
Sets or returns an object for free use by the user.
Pivot3D
  view : Matrix3D
[read-only] Returns the view matrix.
Camera3D
  viewPort : Rectangle
Defines the area where the camera will draw.
Camera3D
  viewProjection : Matrix3D
[read-only] Returns the viewProjection matrix.
Camera3D
 Inheritedvisible : Boolean = true
Sets or returns whether the object is visible.
Pivot3D
 Inheritedworld : Matrix3D
Returns a matrix with the global position, rotation and scale of the object.
Pivot3D
 Inheritedx : Number
Returns or sets the position on the X axis.
Pivot3D
 Inheritedy : Number
Returns or sets the position on the Y axis.
Pivot3D
 Inheritedz : Number
Returns or sets the position on the Z axis.
Pivot3D
  zoom : Number
Sets or returns the camera zoom.
Camera3D
Public Methods
 MethodDefined By
  
Camera3D(name:String, fieldOfView:Number = 75, near:Number = 1, far:Number = 5000)
Camera3D
 Inherited
addChild(pivot:Pivot3D, useGlobalSpace:Boolean = false):Pivot3D
Add a new object as a child.
Pivot3D
 Inherited
addChildAt(pivot:Pivot3D, index:int, useGlobalSpace:Boolean = false):Pivot3D
Pivot3D
 Inherited
addComponent(component:IComponent):Boolean
Adds a new component to the object.
Pivot3D
 Inherited
addFrameScript(frame:int, callback:Function):void
Pivot3D
 Inherited
addLabel(label:Label3D, includeChildren:Boolean = true):Label3D
Adds a label that refers to a given animation.
Pivot3D
 Inherited
Creates a copy of the object and all its elements.
Pivot3D
 Inherited
copyFrom(pivot:Pivot3D):void
Copy basic pivot properties to anotheer pivot.
Pivot3D
 Inherited
copyTransformFrom(source:Pivot3D, local:Boolean = true):void
Copies all transformations (position, rotation and scale) from another Pivot3D object.
Pivot3D
 Inherited
dispose():void
Disposes the pivot and all associated resources.
Pivot3D
 Inherited
download(includeChildren:Boolean = true):void
Pivot3D
 Inherited
draw(includeChildren:Boolean = true, material:Material3D = null):void
Draws the object.
Pivot3D
 Inherited
forEach(callback:Function, filterClass:Class = null, params:Object = null, includeChildren:Boolean = true):void
Excecutes a calback functions for each of his children.
Pivot3D
 Inherited
getBackward(local:Boolean = true, out:Vector3D = null):Vector3D
Returns the direction vector that points to the back of the object.
Pivot3D
 Inherited
getChildByName(name:String, startIndex:int = 0, includeChildren:Boolean = true):Pivot3D
Returns the first child that matches the specified name.
Pivot3D
 Inherited
getChildrenByClass(cl:Class, includeChildren:Boolean = true, out:Vector.<Pivot3D> = null):Vector.<Pivot3D>
Pivot3D
 Inherited
getDir(local:Boolean = true, out:Vector3D = null):Vector3D
Returns the direction vector that points to the front of the object.
Pivot3D
 Inherited
getDown(local:Boolean = true, out:Vector3D = null):Vector3D
Returns the direction vector that points to the bottom side of the object.
Pivot3D
 Inherited
getLeft(local:Boolean = true, out:Vector3D = null):Vector3D
Returns the direction vector that points to the left side of the object.
Pivot3D
 Inherited
getMaterialByName(name:String, includeChildren:Boolean = true):Material3D
Returns the first material that matches the specified name.
Pivot3D
 Inherited
getMaterials(includeChildren:Boolean = true, out:Vector.<Material3D> = null):Vector.<Material3D>
Returns an unique vector of pivot materials currently in use.
Pivot3D
  
getPointDir(x:Number, y:Number, outDir:Vector3D = null, outPos:Vector3D = null):Vector3D
Returns a global 3D direction vector relative to a 2D camera position.
Camera3D
 Inherited
getPosition(local:Boolean = true, out:Vector3D = null):Vector3D
Returns the current position of the object.
Pivot3D
 Inherited
getRight(local:Boolean = true, out:Vector3D = null):Vector3D
Returns the direction vector that points to the right side of the object.
Pivot3D
 Inherited
getRotation(local:Boolean = true, out:Vector3D = null):Vector3D
Returns the current rotation of the object in euler angles.
Pivot3D
 Inherited
getScale(local:Boolean = true, out:Vector3D = null):Vector3D
Returns the current scale of the object.
Pivot3D
 Inherited
getScreenCoords(out:Vector3D = null, camera:Camera3D = null, viewPort:Rectangle = null):Vector3D
Returns the coordinates of an object with respect to the screen.
Pivot3D
 Inherited
getSurfaces(includeChildren:Boolean = true, out:Vector.<Surface3D> = null):Vector.<Surface3D>
Returns an unique vector of surface objects used by the pivots.
Pivot3D
 Inherited
getTextures(includeChildren:Boolean = true, out:Vector.<Texture3D> = null):Vector.<Texture3D>
Returns an unique vector of textures objects used by the pivot materials.
Pivot3D
 Inherited
getUp(local:Boolean = true, out:Vector3D = null):Vector3D
Returns the direction vector that points to the upper side of the object.
Pivot3D
 Inherited
globalToLocal(point:Vector3D, out:Vector3D = null):Vector3D
Transforms a point of the global space of the object into a local space.
Pivot3D
 Inherited
globalToLocalVector(vector:Vector3D, out:Vector3D = null):Vector3D
Transforms a point of the global space of the object into a local space without translation.
Pivot3D
 Inherited
gotoAndPlay(frame:Object, blendFrames:Number = 0, animationMode:int, includeChildren:Boolean = true):void
Starts playing the animation at the specified frame
Pivot3D
 Inherited
gotoAndStop(frame:Object, blendFrames:Number = 0, includeChildren:Boolean = true):void
Stops the animation at the specified frame.
Pivot3D
 Inherited
hide():void
Sets the visible property of this object and all its children recursively to false.
Pivot3D
  
isSphereInView(point:Vector3D, radius:Number, viewSpace:Boolean = false):Boolean
Test if a bounding sphere is inside of the view space (frustrum) of the camera.
Camera3D
 Inherited
localToGlobal(point:Vector3D, out:Vector3D = null):Vector3D
Transforms a point of the local space into the global space.
Pivot3D
 Inherited
localToGlobalVector(vector:Vector3D, out:Vector3D = null):Vector3D
Transforms a point of the local space of the object into a global space without translation.
Pivot3D
 Inherited
lookAt(x:Number, y:Number, z:Number, up:Vector3D = null, smooth:Number = 1):void
Directs the object towards the specified position.
Pivot3D
 Inherited
nextFrame():void
Pivot3D
 Inherited
play(animationMode:int = 0, includeChildren:Boolean = true, resetAnimation:Boolean = true):void
Starts playing the animation.
Pivot3D
 Inherited
prevFrame():void
Pivot3D
 Inherited
Removes a child of the object.
Pivot3D
 Inherited
removeComponent(component:IComponent):Boolean
Removes a component from the object.
Pivot3D
 Inherited
removeLabel(label:Label3D, includeChildren:Boolean = true):Label3D
Removes a label.
Pivot3D
 Inherited
replaceMaterial(source:Material3D, replaceFor:Material3D, includeChildren:Boolean = true):void
Replaces an existing material of the object with another material.
Pivot3D
 Inherited
replaceSurface(source:Surface3D, replaceFor:Surface3D, includeChildren:Boolean = true):void
Replaces an existing surface of the object with another surface.
Pivot3D
 Inherited
replaceTexture(source:Texture3D, replaceFor:Texture3D, includeChildren:Boolean = true):void
Replaces an existing texture of the object materials with another texture.
Pivot3D
 Inherited
Resets the object position, rotation and scale.
Pivot3D
 Inherited
rotateAxis(angle:Number, axis:Vector3D, pivotPoint:Vector3D = null):void
Rotates the object on the specified axis from its current position.
Pivot3D
 Inherited
rotateX(angle:Number, local:Boolean = true, pivotPoint:Vector3D = null):void
Rotates the object on the X axis from its current position.
Pivot3D
 Inherited
rotateY(angle:Number, local:Boolean = true, pivotPoint:Vector3D = null):void
Rotates the object on the Y axis from its current position.
Pivot3D
 Inherited
rotateZ(angle:Number, local:Boolean = true, pivotPoint:Vector3D = null):void
Rotates the pivot on the Z axis from its current position.
Pivot3D
 Inherited
setAnimationLabel(label:Object, animationMode:int, includeChildren:Boolean = true):void
Sets the current animation label.
Pivot3D
 Inherited
setAnimationSmooth(mode:int, includeChildren:Boolean = true):void
Sets the animation interpolation mode for this pivot and its children.
Pivot3D
 Inherited
setLayer(value:int, includeChildren:Boolean = true):void
Sets the layer to render the object and all of his children.
Pivot3D
 Inherited
setMaterial(material:Material3D, includeChildren:Boolean = true):void
Sets a material for the object and, optionally, all its descendants.
Pivot3D
 Inherited
setNormalOrientation(normal:Vector3D, smooth:Number = 1):void
Aligns the object to a normal.
Pivot3D
 Inherited
setOrientation(dir:Vector3D, up:Vector3D = null, smooth:Number = 1):void
Orients the object in a specific direction.
Pivot3D
 Inherited
setPosition(x:Number, y:Number, z:Number, smooth:Number = 1, local:Boolean = true):void
Sets the position of the object.
Pivot3D
 Inherited
setRotation(x:Number, y:Number, z:Number):void
Sets the object rotation using euler angles.
Pivot3D
 Inherited
setScale(x:Number, y:Number, z:Number, smooth:Number = 1):void
Sets the object scale.
Pivot3D
 Inherited
setShadowsProperties(cast:Boolean = false, receive:Boolean = false, includeChildren:Boolean = true):void
Sets whether the object should cast and receive shadows.
Pivot3D
 Inherited
setStatic(value:Boolean, includeChildren:Boolean = true):void
Pivot3D
 Inherited
setTranslation(x:Number = 0, y:Number = 0, z:Number = 0, local:Boolean = true):void
Translates the object from its current position to the specified distance.
Pivot3D
 Inherited
show():void
Sets the visible property of this object and all its children recursively to true.
Pivot3D
 Inherited
startDrag(lockCenter:Boolean = false, refPlaneNormal:Vector3D = null):void
Lets the user drag the specified Pivot3D.
Pivot3D
 Inherited
stop(includeChildren:Boolean = true):void
Pivot3D
 Inherited
stopDrag():void
Ends the startDrag() method.
Pivot3D
 Inherited
translateAxis(distance:Number, axis:Vector3D):void
Translates the object on a certain axis from its current position.
Pivot3D
 Inherited
translateX(distance:Number, local:Boolean = true):void
Translates the object on the X axis from its current position.
Pivot3D
 Inherited
translateY(distance:Number, local:Boolean = true):void
Translates the object on the Y axis from its current position.
Pivot3D
 Inherited
translateZ(distance:Number, local:Boolean = true):void
Translates the object on the Z axis from its current position.
Pivot3D
 Inherited
update():void
Pivot3D
  
Updates the camera projection matrix.
Camera3D
 Inherited
updateTransforms(includeChildren:Boolean = false):void
This method is used to force the system to update the object in those cases where its matrices have been modified manually.
Pivot3D
 Inherited
upload(scene:Scene3D, includeChildren:Boolean = true):void
Pivot3D
Events
 Event Summary Defined By
 InheritedThis event occurs when the object is added to a scene or to any other object.Pivot3D
 InheritedThis event occurs when the object is added to a scene.Pivot3D
 InheritedThis event occurs at the end of an animation.Pivot3D
 InheritedThis event occurs whatever the object changes his position, rotation or scale.Pivot3D
 InheritedThis event occurs before drag the object.Pivot3D
 InheritedThis event occurs before draw the object.Pivot3D
 InheritedThis event occurs before entering any frame.Pivot3D
 InheritedThis event occurs after drag the object.Pivot3D
 InheritedThis event occurs after draw the object.Pivot3D
 InheritedThis event occurs after updating every frame.Pivot3D
 InheritedThis event occurs when the object is removed from a scene or from any other object.Pivot3D
 InheritedThis event occurs when the object is removed from a scene.Pivot3D
 InheritedThis event occurs when the dispose method of the object itself or of a parent object is called.Pivot3D
Public Constants
 ConstantDefined By
 InheritedADDED_EVENT : String = added
[static] Defines the value for the 'added' event.
Pivot3D
 InheritedADDED_TO_SCENE_EVENT : String = addedToScene
[static] Defines the value for the 'addedToScene' event.
Pivot3D
 InheritedANIMATION_COMPLETE_EVENT : String = animationComplete
[static] Defines the value for the 'animationComplete' event.
Pivot3D
 InheritedANIMATION_LOOP_MODE : int = 0
[static]
Pivot3D
 InheritedANIMATION_PING_PONG_MODE : int = 1
[static]
Pivot3D
 InheritedANIMATION_SMOOTH_BEST : int = 2
[static]
Pivot3D
 InheritedANIMATION_SMOOTH_NONE : int = 0
[static]
Pivot3D
 InheritedANIMATION_SMOOTH_NORMAL : int = 1
[static]
Pivot3D
 InheritedANIMATION_STOP_MODE : int = 2
[static]
Pivot3D
 InheritedENTER_DRAG_EVENT : String = enterDrag
[static] Defines the value for the 'enterDrag' event.
Pivot3D
 InheritedENTER_DRAW_EVENT : String = enterDraw
[static] Defines the value for the 'enterDraw' event.
Pivot3D
 InheritedENTER_FRAME_EVENT : String = enterFrame
[static] Defines the value for the 'enterFrame' event.
Pivot3D
 InheritedEXIT_DRAG_EVENT : String = exitDrag
[static] Defines the value for the 'exitDrag' event.
Pivot3D
 InheritedEXIT_DRAW_EVENT : String = exitDraw
[static] Defines the value for the 'exitDraw' event.
Pivot3D
 InheritedEXIT_FRAME_EVENT : String = exitFrame
[static] Defines the value for the 'exitFrame' event.
Pivot3D
  FOV_HORIZONTAL : int = 0
[static] Defines an horizontal fov mode to be used in fovMode property.
Camera3D
  FOV_VERTICAL : int = 1
[static] Defines a vertical fov mode to be used in fovMode property.
Camera3D
 InheritedREMOVED_EVENT : String = removed
[static] Defines the value for the 'removed' event.
Pivot3D
 InheritedREMOVED_FROM_SCENE_EVENT : String = removedFromScene
[static] Defines the value for the 'removedFromScene' event.
Pivot3D
 InheritedSORT_CENTER : int = 1
[static]
Pivot3D
 InheritedSORT_FAR : int = 4
[static]
Pivot3D
 InheritedSORT_NEAR : int = 2
[static]
Pivot3D
 InheritedSORT_NONE : int = 0
[static]
Pivot3D
 InheritedUNLOAD_EVENT : String = unload
[static] Defines the value for the 'unload' event.
Pivot3D
 InheritedUPDATE_TRANSFORM_EVENT : String = updateTransform
[static] Defines the value for the 'updateTransform' event.
Pivot3D
Property Detail
aspectRatioproperty
aspectRatio:Number

Sets or returns the aspect ratio of the camera.


Implementation
    public function get aspectRatio():Number
    public function set aspectRatio(value:Number):void
canvasSizeproperty 
canvasSize:Point

Defines the projection area for the camera viewPort. If no canvasSize is defined, the values from scene viewPort are used. This property could be used in case where you need to render to a texture that has different dimensions that the scene viewport.


Implementation
    public function get canvasSize():Point
    public function set canvasSize(value:Point):void
clipRectangleproperty 
public var clipRectangle:Boolean = true

Defines if the viewPort clip all pixels outside the viewPort.

farproperty 
far:Number

Sets or returns the furthest clip plane from the camera. The higher the value, the further the camera will view. This value corresponds to the distance between the camera and the plane. Everything beyond that distance is not to be rendered. For optimization purposes, complex scenes with a large number of polygons should not have a high value to avoid the unnecessary rendering of objects that are too far.


Implementation
    public function get far():Number
    public function set far(value:Number):void

See also

fieldOfViewproperty 
fieldOfView:Number

Sets and returns the camera’s angle of view. The angle of view is inversely proportional to the zoom. The wider the angle, the closer the projection plane and, therefore, the shorter the zoom.


Implementation
    public function get fieldOfView():Number
    public function set fieldOfView(value:Number):void

See also

fovModeproperty 
public var fovMode:int = 0

Defines whatever fov mode should be used to calculate the projection matrix. By default an horizontal fov is used, but for vertical layouts like mobile phones, a vertical fov may be more convinient.

See also

frustumproperty 
frustum:Vector.<Number>  [read-only]


Implementation
    public function get frustum():Vector.<Number>
nearproperty 
near:Number

Sets or returns the clip plane that is closest to the camera. Its value must be greater than zero. Everything beyond this virtual plane is not to be rendered. The value corresponds to the distance between the camera and the plane. This value should be set at the furthest possible point from the camera. This is likely to result in improved performance, especially in those situations where objects go through the camera plane.


Implementation
    public function get near():Number
    public function set near(value:Number):void

See also

orthographicproperty 
public var orthographic:Boolean = false

projectionproperty 
projection:Matrix3D

Returns the projection matrix.


Implementation
    public function get projection():Matrix3D
    public function set projection(value:Matrix3D):void
viewproperty 
view:Matrix3D  [read-only]

Returns the view matrix.


Implementation
    public function get view():Matrix3D
viewPortproperty 
viewPort:Rectangle

Defines the area where the camera will draw. This area is relative to the scene viewport or canvasSize if it is defined.


Implementation
    public function get viewPort():Rectangle
    public function set viewPort(value:Rectangle):void
viewProjectionproperty 
viewProjection:Matrix3D  [read-only]

Returns the viewProjection matrix.


Implementation
    public function get viewProjection():Matrix3D
zoomproperty 
zoom:Number

Sets or returns the camera zoom. The zoom is the distance between the point of origin of the camera and the projection plane.


Implementation
    public function get zoom():Number
    public function set zoom(value:Number):void

See also

Constructor Detail
Camera3D()Constructor
public function Camera3D(name:String, fieldOfView:Number = 75, near:Number = 1, far:Number = 5000)



Parameters
name:String
 
fieldOfView:Number (default = 75)
 
near:Number (default = 1)
 
far:Number (default = 5000)
Method Detail
getPointDir()method
public function getPointDir(x:Number, y:Number, outDir:Vector3D = null, outPos:Vector3D = null):Vector3D

Returns a global 3D direction vector relative to a 2D camera position.

Parameters

x:Number — The x position over the camera viewport.
 
y:Number — The y position over the camera viewport.
 
outDir:Vector3D (default = null) — A reference vector to return the direction vector.
 
outPos:Vector3D (default = null)

Returns
Vector3D — If the 'out' is 'null', a new vector will be returned. Otherwise, the same vector, passed to the 'out' parameter, will be returned.
isSphereInView()method 
public function isSphereInView(point:Vector3D, radius:Number, viewSpace:Boolean = false):Boolean

Test if a bounding sphere is inside of the view space (frustrum) of the camera.

Parameters

point:Vector3D — The center of the sphere to test.
 
radius:Number — The radius of the sphere to test.
 
viewSpace:Boolean (default = false) — true if the given sphere point is already transformed in camera view space, otherwise, the point should be in world space and will be automatically projected into camera view space.

Returns
Boolean — true if the volume sphere is in the view space (frustrum) of the camera.
updateProjectionMatrix()method 
public function updateProjectionMatrix():void

Updates the camera projection matrix.

Constant Detail
FOV_HORIZONTALConstant
public static const FOV_HORIZONTAL:int = 0

Defines an horizontal fov mode to be used in fovMode property.

See also

FOV_VERTICALConstant 
public static const FOV_VERTICAL:int = 1

Defines a vertical fov mode to be used in fovMode property.

See also