Packageorg.papervision3d.objects
Classpublic class DisplayObject3D
InheritanceDisplayObject3D Inheritance DisplayObjectContainer3D Inheritance flash.events.EventDispatcher
SubclassesCameraObject3D, Collada, DAE, LightObject3D, Mouse3D, Sound3D, Vertices3D

The DisplayObject class represents instances of 3D objects that are contained in the scene.

That includes all objects in the scene, not only those that can be rendered, but also the camera and its target.

The DisplayObject3D class supports basic functionality like the x, y and z position of an object, as well as rotationX, rotationY, rotationZ, scaleX, scaleY and scaleZ and visible. It also supports more advanced properties of the object such as its transform Matrix3D.

DisplayObject3D is not an abstract base class; therefore, you can call DisplayObject3D directly. Invoking new DisplayObject() creates a new empty object in 3D space, like when you used createEmptyMovieClip().



Public Properties
 PropertyDefined by
 Inheritedchildren : Object
Returns the children object.
DisplayObjectContainer3D
  containerBlendMode : int
DisplayObject3D
  containerSortMode : int
DisplayObject3D
  culled : Boolean
[internal use] Is this object culled by camera frustum?
DisplayObject3D
  extra : Object
An object that contains user defined properties.
DisplayObject3D
  faceLevelMode : Boolean
[static] This allows objects faces to have their own containers.
DisplayObject3D
  faces : Array
[internal-use]
DisplayObject3D
  filters : Array
DisplayObject3D
  geometry : GeometryObject3D
The GeometryObject3D object that contains the 3D definition of this instance.
DisplayObject3D
  id : int
[read-only] Unique id of this instance.
DisplayObject3D
  material : MaterialObject3D
DisplayObject3D
  materials : MaterialsList
The list of materials for this instance.
DisplayObject3D
  meshSort : uint = 1
tells Mesh3D's render() method to compare the measurement choice of the user for a triangle's sorting
DisplayObject3D
  name : String
An optional object name.
DisplayObject3D
 InheritednumChildren : int
Returns the number of children of this object.
DisplayObjectContainer3D
  parent : DisplayObjectContainer3D
[read-only] Indicates the DisplayObjectContainer3D object that contains this display object.
DisplayObject3D
 Inheritedroot : DisplayObjectContainer3D
[read-only] [read-only] The scene, which is the top-most displayObjectContainer3D in the tree structure.
DisplayObjectContainer3D
  rotationX : Number
Specifies the rotation around the X axis from its original orientation.
DisplayObject3D
  rotationY : Number
Specifies the rotation around the Y axis from its original orientation.
DisplayObject3D
  rotationZ : Number
Specifies the rotation around the Z axis from its original orientation.
DisplayObject3D
  scale : Number
Sets the 3D scale as applied from the registration point of the object.
DisplayObject3D
  scaleX : Number
Sets the scale along the local X axis as applied from the registration point of the object.
DisplayObject3D
  scaleY : Number
Sets the scale along the local Y axis as applied from the registration point of the object.
DisplayObject3D
  scaleZ : Number
Sets the scale along the local Z axis as applied from the registration point of the object.
DisplayObject3D
  scene : SceneObject3D
DisplayObject3D
  sceneX : Number
[read-only] The X coordinate of a object relative to the scene coordinate system.
DisplayObject3D
  sceneY : Number
[read-only] The Y coordinate of a object relative to the scene coordinate system.
DisplayObject3D
  sceneZ : Number
[read-only] The Z coordinate of a object relative to the scene coordinate system.
DisplayObject3D
  screen : Number3D
[read-only] The coordinate of the object on screen.
DisplayObject3D
  screenZ : Number
[internal-use] The average depth of the object faces center.
DisplayObject3D
  sortedArray : Array
[static]
DisplayObject3D
  transform : Matrix3D
A Matrix3D object containing values that affect the scaling, rotation, and translation of the display object.
DisplayObject3D
  useOwnContainer : Boolean
DisplayObject3D
  view : Matrix3D
[internal-use] A camera transformed Matrix3D object.
DisplayObject3D
  visible : Boolean
Whether or not the display object is visible.
DisplayObject3D
  world : Matrix3D
World transformation.
DisplayObject3D
  x : Number
An Number that sets the X coordinate of a object relative to the origin of its parent.
DisplayObject3D
  y : Number
An Number that sets the Y coordinate of a object relative to the origin of its parent.
DisplayObject3D
  z : Number
An Number that sets the Z coordinate of a object relative to the origin of its parent.
DisplayObject3D
  ZERO : DisplayObject3D
[static][read-only] Returns an empty DiplayObject3D object positioned in the center of the 3D coordinate system (0, 0 ,0).
DisplayObject3D
Protected Properties
 PropertyDefined by
 Inherited_children : Dictionary
[internal-use] Names indexed by children.
DisplayObjectContainer3D
 Inherited_childrenByName : Object
[internal-use] Children indexed by name.
DisplayObjectContainer3D
  _containerBlendMode : int
DisplayObject3D
  _containerSortMode : int
DisplayObject3D
  _filters : Array
DisplayObject3D
  _scene : SceneObject3D = null
The scene where the object belongs.
DisplayObject3D
  _sorted : Array
DisplayObject3D
  _transformDirty : Boolean = false
[internal-use]
DisplayObject3D
  _useOwnContainer : Boolean
DisplayObject3D
Public Methods
 MethodDefined by
  
DisplayObject3D(name:String = null, geometry:GeometryObject3D = null, initObject:Object = null)
Creates a new DisplayObject3D instance.
DisplayObject3D
  
addChild(child:DisplayObject3D, name:String = null):DisplayObject3D
Adds a child DisplayObject3D instance to this DisplayObjectContainer instance.
DisplayObject3D
 Inherited
Adds all the children of a DisplayObject3D instance to this DisplayObjectContainer instance.
DisplayObjectContainer3D
 Inherited
addCollada(filename:String, materials:MaterialsList = null, scale:Number = 1):void
This method has been deprecated.
DisplayObjectContainer3D
  
addGeometry(geometry:GeometryObject3D = null):void
Adds a geometry definition to the instance.
DisplayObject3D
 Inherited
childrenList():String
Returns a string value with the list of objects.
DisplayObjectContainer3D
  
copyPosition(reference:*):void
Copies the position information (x, y and z coordinates) from another object or Matrix3D.
DisplayObject3D
  
copyTransform(reference:*):void
Copies the transformation information (position, rotation and scale) from another object or Matrix3D.
DisplayObject3D
  
Gets the distance to the position of the given object.
DisplayObject3D
 Inherited
Returns the child display object that exists with the specified name.
DisplayObjectContainer3D
  
Returns the material that exists with the specified name in the materials list.
DisplayObject3D
  
hitTestObject(obj:DisplayObject3D, multiplier:Number = 1):Boolean
Evaluates the display object to see if it overlaps or intersects with the obj display object.
DisplayObject3D
  
hitTestPoint(x:Number, y:Number, z:Number):Boolean
Evaluates the display object to see if it overlaps or intersects with the point specified by the x, y and z parameters.
DisplayObject3D
  
lookAt(targetObject:DisplayObject3D, upAxis:Number3D = null):void
Make the object look at a specific position.
DisplayObject3D
  
materialsList():String
Returns a string value with the list of material names of the materials list.
DisplayObject3D
  
moveBackward(distance:Number):void
Translate the display object in the opposite direction it is facing, i.e.
DisplayObject3D
  
moveDown(distance:Number):void
Translate the display object downwards, with respect to the direction it is facing, i.e.
DisplayObject3D
  
moveForward(distance:Number):void
Translate the display object in the direction it is facing, i.e.
DisplayObject3D
  
moveLeft(distance:Number):void
Translate the display object lateraly, to the left of the direction it is facing, i.e.
DisplayObject3D
  
moveRight(distance:Number):void
Translate the display object lateraly, to the right of the direction it is facing, i.e.
DisplayObject3D
  
moveUp(distance:Number):void
Translate the display object upwards, with respect to the direction it is facing, i.e.
DisplayObject3D
  
pitch(angle:Number):void
Rotate the display object around its lateral or transverse axis —an axis running from the pilot's left to right in piloted aircraft, and parallel to the wings of a winged aircraft; thus the nose pitches up and the tail down, or vice-versa.
DisplayObject3D
  
project(parent:DisplayObject3D, renderSessionData:RenderSessionData):Number
[internal-use] Projects three dimensional coordinates onto a two dimensional plane to simulate the relationship of the camera to subject.
DisplayObject3D
 Inherited
Removes the specified child DisplayObject3D instance from the child list of the DisplayObjectContainer3D instance.
DisplayObjectContainer3D
 Inherited
Removes the child DisplayObject3D instance that exists with the specified name, from the child list of the DisplayObjectContainer3D instance.
DisplayObjectContainer3D
  
roll(angle:Number):void
Rotate the display object around the longitudinal axis —an axis drawn through the body of the vehicle from tail to nose in the normal direction of flight, or the direction the object is facing.
DisplayObject3D
  
toString():String
Returns a string value representing the three-dimensional position values of the display object instance.
DisplayObject3D
  
translate(distance:Number, axis:Number3D):void
Move the object along a given direction.
DisplayObject3D
  
yaw(angle:Number):void
Rotate the display object around about the vertical axis —an axis drawn from top to bottom.
DisplayObject3D
Protected Methods
 MethodDefined by
  
[internal-use] Updates the transform Matrix3D with the current rotation and scale values.
DisplayObject3D
Public Constants
 ConstantDefined by
  MESH_SORT_CENTER : uint = 1
[static] tells Mesh3D's render() method to sort by measuring from the center of a triangle
DisplayObject3D
  MESH_SORT_CLOSE : uint = 3
[static] tells Mesh3D's render() method to sort by measuring from the closest point of a triangle
DisplayObject3D
  MESH_SORT_FAR : uint = 2
[static] tells Mesh3D's render() method to sort by measuring from the farthest point of a triangle
DisplayObject3D
Property detail
_containerBlendModeproperty
protected var _containerBlendMode:int
containerBlendModeproperty 
containerBlendMode:int  [read-write]Implementation
    public function get containerBlendMode():int
    public function set containerBlendMode(value:int):void
_containerSortModeproperty 
protected var _containerSortMode:int
containerSortModeproperty 
containerSortMode:int  [read-write]Implementation
    public function get containerSortMode():int
    public function set containerSortMode(value:int):void
culledproperty 
public var culled:Boolean

[internal use] Is this object culled by camera frustum?

extraproperty 
public var extra:Object

An object that contains user defined properties.

All properties of the extra field are copied into the new instance. The properties specified with extra are publicly available.

faceLevelModeproperty 
public static var faceLevelMode:Boolean

This allows objects faces to have their own containers.

facesproperty 
public var faces:Array

[internal-use]

_filtersproperty 
protected var _filters:Array
filtersproperty 
filters:Array  [read-write]Implementation
    public function get filters():Array
    public function set filters(value:Array):void
geometryproperty 
public var geometry:GeometryObject3D

The GeometryObject3D object that contains the 3D definition of this instance.

When different objects share the same geometry, they become instances. They are the same object, displayed multiple times. Changing the shape of this object changes the shape of all of its instances.

Instancing an object saves system memory, and is useful to display an object multiple times while maintaining its shape.

For example, you could create armies and forests full of duplicate objects without needing the memory to handle that much actual geometry. Each instance has its own transform node so it can have its own position, rotation, and scaling.

idproperty 
public var id:int

[read-only] Unique id of this instance.

materialproperty 
material:MaterialObject3D  [read-write]Implementation
    public function get material():MaterialObject3D
    public function set material(value:MaterialObject3D):void
materialsproperty 
public var materials:MaterialsList

The list of materials for this instance.

meshSortproperty 
public var meshSort:uint = 1

tells Mesh3D's render() method to compare the measurement choice of the user for a triangle's sorting

nameproperty 
public var name:String

An optional object name.

parentproperty 
public var parent:DisplayObjectContainer3D

[read-only] Indicates the DisplayObjectContainer3D object that contains this display object.

rotationXproperty 
rotationX:Number  [read-write]

Specifies the rotation around the X axis from its original orientation.

Implementation
    public function get rotationX():Number
    public function set rotationX(value:Number):void
rotationYproperty 
rotationY:Number  [read-write]

Specifies the rotation around the Y axis from its original orientation.

Implementation
    public function get rotationY():Number
    public function set rotationY(value:Number):void
rotationZproperty 
rotationZ:Number  [read-write]

Specifies the rotation around the Z axis from its original orientation.

Implementation
    public function get rotationZ():Number
    public function set rotationZ(value:Number):void
scaleproperty 
scale:Number  [read-write]

Sets the 3D scale as applied from the registration point of the object.

Implementation
    public function get scale():Number
    public function set scale(value:Number):void
scaleXproperty 
scaleX:Number  [read-write]

Sets the scale along the local X axis as applied from the registration point of the object.

Implementation
    public function get scaleX():Number
    public function set scaleX(value:Number):void
scaleYproperty 
scaleY:Number  [read-write]

Sets the scale along the local Y axis as applied from the registration point of the object.

Implementation
    public function get scaleY():Number
    public function set scaleY(value:Number):void
scaleZproperty 
scaleZ:Number  [read-write]

Sets the scale along the local Z axis as applied from the registration point of the object.

Implementation
    public function get scaleZ():Number
    public function set scaleZ(value:Number):void
_sceneproperty 
protected var _scene:SceneObject3D = null

The scene where the object belongs.

sceneproperty 
scene:SceneObject3D  [read-write]Implementation
    public function get scene():SceneObject3D
    public function set scene(value:SceneObject3D):void
sceneXproperty 
sceneX:Number  [read-only]

The X coordinate of a object relative to the scene coordinate system.

Implementation
    public function get sceneX():Number
sceneYproperty 
sceneY:Number  [read-only]

The Y coordinate of a object relative to the scene coordinate system.

Implementation
    public function get sceneY():Number
sceneZproperty 
sceneZ:Number  [read-only]

The Z coordinate of a object relative to the scene coordinate system.

Implementation
    public function get sceneZ():Number
screenproperty 
public var screen:Number3D

[read-only] The coordinate of the object on screen.

screenZproperty 
public var screenZ:Number

[internal-use] The average depth of the object faces center. Used internally for z-sorting.

_sortedproperty 
protected var _sorted:Array
sortedArrayproperty 
public static var sortedArray:Array
transformproperty 
public var transform:Matrix3D

A Matrix3D object containing values that affect the scaling, rotation, and translation of the display object.

_transformDirtyproperty 
protected var _transformDirty:Boolean = false

[internal-use]

_useOwnContainerproperty 
protected var _useOwnContainer:Boolean
useOwnContainerproperty 
useOwnContainer:Boolean  [read-write]Implementation
    public function get useOwnContainer():Boolean
    public function set useOwnContainer(value:Boolean):void
viewproperty 
public var view:Matrix3D

[internal-use] A camera transformed Matrix3D object.

visibleproperty 
public var visible:Boolean

Whether or not the display object is visible.

A Boolean value that indicates whether the object is projected, transformed and rendered. A value of false will effectively ignore the object. The default value is true.

worldproperty 
public var world:Matrix3D

World transformation.

xproperty 
x:Number  [read-write]

An Number that sets the X coordinate of a object relative to the origin of its parent.

Implementation
    public function get x():Number
    public function set x(value:Number):void
yproperty 
y:Number  [read-write]

An Number that sets the Y coordinate of a object relative to the origin of its parent.

Implementation
    public function get y():Number
    public function set y(value:Number):void
zproperty 
z:Number  [read-write]

An Number that sets the Z coordinate of a object relative to the origin of its parent.

Implementation
    public function get z():Number
    public function set z(value:Number):void
ZEROproperty 
ZERO:DisplayObject3D  [read-only]

Returns an empty DiplayObject3D object positioned in the center of the 3D coordinate system (0, 0 ,0).

Implementation
    public static function get ZERO():DisplayObject3D
Constructor detail
DisplayObject3D()constructor
public function DisplayObject3D(name:String = null, geometry:GeometryObject3D = null, initObject:Object = null)

Creates a new DisplayObject3D instance. After creating the instance, call the addChild() method of a DisplayObjectContainer3D.

Parameters
name:String (default = null) — [optional] - The name of the newly created object.
 
geometry:GeometryObject3D (default = null) — [optional] - The geometry of the newly created object.
 
initObject:Object (default = null) — [optional] - An object that contains user defined properties with which to populate the newly created DisplayObject3D.
  • x: An Number that sets the X coordinate of a object relative to the scene coordinate system.
  • y: An Number that sets the Y coordinate of a object relative to the scene coordinate system.
  • z: An Number that sets the Z coordinate of a object relative to the scene coordinate system.
  • rotationX: Specifies the rotation around the X axis from its original orientation.
  • rotationY: Specifies the rotation around the Y axis from its original orientation.
  • rotationZ: Specifies the rotation around the Z axis from its original orientation.
  • scaleX: Sets the scale along the local X axis as applied from the registration point of the object.
  • scaleY: Sets the scale along the local Y axis as applied from the registration point of the object.
  • scaleZ: Sets the scale along the local Z axis as applied from the registration point of the object.
  • visible: Whether or not the display object is visible.

    A Boolean value that indicates whether the object is projected, transformed and rendered. A value of false will effectively ignore the object. The default value is true.

  • container: The MovieClip that you draw into when rendering. Use only when the object is rendered in its own unique MovieClip.

    It's Boolean value determines whether the container MovieClip should be cleared before rendering.

  • extra: An object that contains user defined properties.

    All properties of the extra field are copied into the new instance. The properties specified with extra are publicly available.

Method detail
addChild()method
public override function addChild(child:DisplayObject3D, name:String = null):DisplayObject3D

Adds a child DisplayObject3D instance to this DisplayObjectContainer instance. [TODO: If you add a child object that already has a different display object container as a parent, the object is removed from the child list of the other display object container.]

Parameters
child:DisplayObject3D — The DisplayObject3D instance to add as a child of this DisplayObjectContainer3D instance.
 
name:String (default = null) — An optional name of the child to add or create. If no name is provided, the child name will be used.

Returns
DisplayObject3D — The DisplayObject3D instance that you have added or created.
addGeometry()method 
public function addGeometry(geometry:GeometryObject3D = null):void

Adds a geometry definition to the instance. A geometry describes the visual shape and appearance of an object in a scene.

Parameters
geometry:GeometryObject3D (default = null) — A geometry definition.
copyPosition()method 
public function copyPosition(reference:*):void

Copies the position information (x, y and z coordinates) from another object or Matrix3D.

Parameters
reference:* — A DisplayObject3D or Matrix3D object to copy the position from.
copyTransform()method 
public function copyTransform(reference:*):void

Copies the transformation information (position, rotation and scale) from another object or Matrix3D.

Parameters
reference:* — A DisplayObject3D or Matrix3D object to copy the position from.
distanceTo()method 
public function distanceTo(obj:DisplayObject3D):Number

Gets the distance to the position of the given object.

Parameters
obj:DisplayObject3D — The display object to measure the distance to.

Returns
Number — The distance to the registration point of the given object.
getMaterialByName()method 
public function getMaterialByName(name:String):MaterialObject3D

Returns the material that exists with the specified name in the materials list.

If more that one material object has the specified name, the method returns the first material object in the materials list.

Parameters
name:String — The name of the material to return.

Returns
MaterialObject3D — The material object with the specified name.
hitTestObject()method 
public function hitTestObject(obj:DisplayObject3D, multiplier:Number = 1):Boolean

Evaluates the display object to see if it overlaps or intersects with the obj display object.

Parameters
obj:DisplayObject3D — The display object to test against.
 
multiplier:Number (default = 1)

Returns
Boolean — true if the display objects intersect; false if not.
hitTestPoint()method 
public function hitTestPoint(x:Number, y:Number, z:Number):Boolean

Evaluates the display object to see if it overlaps or intersects with the point specified by the x, y and z parameters.

The x, y and z parameters specify a point in the coordinate space of the instance parent object, not the scene (unless that parent object is the scene).

Parameters
x:Number — The x coordinate to test against this object.
 
y:Number — The y coordinate to test against this object.
 
z:Number — The z coordinate to test against this object.

Returns
Boolean — true if the display object overlaps or intersects with the specified point; false otherwise.
lookAt()method 
public function lookAt(targetObject:DisplayObject3D, upAxis:Number3D = null):void

Make the object look at a specific position.

Parameters
targetObject:DisplayObject3D — Object to look at.
 
upAxis:Number3D (default = null) — The vertical axis of the universe. Normally the positive Y axis.
materialsList()method 
public function materialsList():String

Returns a string value with the list of material names of the materials list.

Returns
String — A string.
moveBackward()method 
public function moveBackward(distance:Number):void

Translate the display object in the opposite direction it is facing, i.e. it's negative Z axis.

Parameters
distance:Number — The distance that the object should move backward.
moveDown()method 
public function moveDown(distance:Number):void

Translate the display object downwards, with respect to the direction it is facing, i.e. it's negative Y axis.

Parameters
distance:Number — The distance that the object should move down.
moveForward()method 
public function moveForward(distance:Number):void

Translate the display object in the direction it is facing, i.e. it's positive Z axis.

Parameters
distance:Number — The distance that the object should move forward.
moveLeft()method 
public function moveLeft(distance:Number):void

Translate the display object lateraly, to the left of the direction it is facing, i.e. it's negative X axis.

Parameters
distance:Number — The distance that the object should move left.
moveRight()method 
public function moveRight(distance:Number):void

Translate the display object lateraly, to the right of the direction it is facing, i.e. it's positive X axis.

Parameters
distance:Number — The distance that the object should move right.
moveUp()method 
public function moveUp(distance:Number):void

Translate the display object upwards, with respect to the direction it is facing, i.e. it's positive Y axis.

Parameters
distance:Number — The distance that the object should move up.
pitch()method 
public function pitch(angle:Number):void

Rotate the display object around its lateral or transverse axis —an axis running from the pilot's left to right in piloted aircraft, and parallel to the wings of a winged aircraft; thus the nose pitches up and the tail down, or vice-versa.

Parameters
angle:Number — The angle to rotate.
project()method 
public function project(parent:DisplayObject3D, renderSessionData:RenderSessionData):Number

[internal-use] Projects three dimensional coordinates onto a two dimensional plane to simulate the relationship of the camera to subject.

This is the first step in the process of representing three dimensional shapes two dimensionally.

Parameters
parent:DisplayObject3D — The DisplayObject3D object that contains this display object.
 
renderSessionData:RenderSessionData — Data for the current render.

Returns
Number
roll()method 
public function roll(angle:Number):void

Rotate the display object around the longitudinal axis —an axis drawn through the body of the vehicle from tail to nose in the normal direction of flight, or the direction the object is facing.

Parameters
angle:Number
setLayerForViewport()method 
pv3dview function setLayerForViewport(layer:ViewportLayer):voidParameters
layer:ViewportLayer
toString()method 
public override function toString():String

Returns a string value representing the three-dimensional position values of the display object instance.

Returns
String — A string.
translate()method 
public function translate(distance:Number, axis:Number3D):void

Move the object along a given direction.

Parameters
distance:Number — The distance that the object should travel.
 
axis:Number3D — The direction that the object should move towards.
updateTransform()method 
protected function updateTransform():void

[internal-use] Updates the transform Matrix3D with the current rotation and scale values.

yaw()method 
public function yaw(angle:Number):void

Rotate the display object around about the vertical axis —an axis drawn from top to bottom.

Parameters
angle:Number — The angle to rotate.
Constant detail
MESH_SORT_CENTERconstant
public static const MESH_SORT_CENTER:uint = 1

tells Mesh3D's render() method to sort by measuring from the center of a triangle

MESH_SORT_CLOSEconstant 
public static const MESH_SORT_CLOSE:uint = 3

tells Mesh3D's render() method to sort by measuring from the closest point of a triangle

MESH_SORT_FARconstant 
public static const MESH_SORT_FAR:uint = 2

tells Mesh3D's render() method to sort by measuring from the farthest point of a triangle