Packagesandy.core.scenegraph
Classpublic class ATransformable
InheritanceATransformable Inheritance Node
SubclassesCamera3D, Shape3D, Sprite2D, Sprite3D, TransformGroup

ABSTRACT CLASS - super class for all movable objects in the object tree.

This class should not be directly instatiated, but sub classed.
The Atransformable class is resposible for scaling, rotation and translation of objects in 3D space.

Rotations and translations are performed in one of three coordinate systems or reference frames:
- The local frame which is the objects own coordinate system
- The parent frame which is the coordinate system of the object's parent, normally a TransformGroup
- The world frame which is the coordinate system of the world, the global system.

Positions, directions, translations and rotations of an ATransformable object are performed in its parent frame.
Tilt, pan and roll, are rotations around the local axes, and moveForward, moveUpwards and moveSideways are translations along local axes.



Public Properties
 PropertyDefined by
 InheritedboundingBox : BBox
The bounding box of this node IMPORTANT: Do not modify it unless you perfectly know what you are doing
Node
 InheritedboundingSphere : BSphere
The bounding sphere of this node IMPORTANT: Do not modify it unless you perfectly know what you are doing
Node
 Inheritedbroadcaster : BubbleEventBroadcaster
The broadcaster

The broadcaster is used to send events to listeners.
This property is a BubbleEventBroadcaster.

Node
 Inheritedchanged : Boolean = false
This property set the cache status of the current node.
Node
 Inheritedchildren : Array
The children of this node are stored inside this array.
Node
 Inheritedculled : CullingState
This property represent the culling state of the current node.
Node
  disable : Boolean = false
Disable the local transformations applied to this Node if set to false.
ATransformable
  matrix : Matrix4
ATransformable
 InheritedmodelMatrix : Matrix4
Cached matrix corresponding to the transformation to the 0,0,0 frame system
Node
 Inheritedname : String
Name of this node.
Node
  out : Vector
[read-only] Forward direction ( local z ) in parent coordinates.
ATransformable
  pan : Number
Pans this object around the local y axis.
ATransformable
 Inheritedparent : Node
The parent node of this node.
Node
  roll : Number
Rolls this object around the local z axis.
ATransformable
  rotateX : Number
Rotates this object around an axis parallel to the parents x axis.
ATransformable
  rotateY : Number
Rotates this object around an axis parallel to the parents y axis.
ATransformable
  rotateZ : Number
Rotates this object around an axis paralell to the parents z axis.
ATransformable
  scaleX : Number
x scale of this object.
ATransformable
  scaleY : Number
y scale of this object.
ATransformable
  scaleZ : Number
z scale of this object.
ATransformable
 Inheritedscene : Scene3D = null
Reference to the scene is it linked to.
Node
  side : Vector
[read-only] Side direction ( local x ) in parent coordinates.
ATransformable
  target : Vector
[write-only] The position in the parent frame this object should "look at".
ATransformable
  tilt : Number
Getter for the tilt value
ATransformable
  up : Vector
[read-only] Up direction ( local y ) in parent coordinates.
ATransformable
 InheritedviewMatrix : Matrix4
Cached matrix corresponding to the transformation to the camera frame system
Node
 Inheritedvisible : Boolean = true
Specify the visibility of this node.
Node
  x : Number
x position of this object in its parent frame.
ATransformable
  y : Number
y position of this object in its parent frame.
ATransformable
  z : Number
z position of the node in its parent frame.
ATransformable
Protected Properties
 PropertyDefined by
 Inheritedm_oEB : BubbleEventBroadcaster
Node
  m_oPreviousOffsetRotation : Vector
ATransformable
  m_tmpMt : Matrix4
ATransformable
  _oScale : Vector
ATransformable
  _p : Vector
ATransformable
  _vOut : Vector
ATransformable
  _vSide : Vector
ATransformable
  _vUp : Vector
ATransformable
Public Methods
 MethodDefined by
  
ATransformable(p_sName:String = "")
Creates a transformable node in the object tree of the world.
ATransformable
 Inherited
addChild(p_oChild:Node):void
Adds a new child to this node.
Node
 Inherited
addEventListener(p_sEvt:String, p_oL:*):void
Adds a listener for the specified event.
Node
 Inherited
cull(p_oScene:Scene3D, p_oFrustum:Frustum, p_oViewMatrix:Matrix4, p_bChanged:Boolean):void
Tests this node against the frustum volume to get its visibility.
Node
 Inherited
destroy():void
Delete this node and all its child nodes.
Node
 Inherited
getChildByName(p_sName:String, p_bRecurs:Boolean = false):Node
Returns the child node with the specified name.
Node
 Inherited
getChildFromId(p_nId:uint, p_bRecurs:Boolean = false):Node
Returns the child node with the specified id.
Node
 Inherited
getChildList():Array
Returns an array with all child nodes of this node.
Node
  
getPosition(p_sMode:String = "local"):Vector
Returns the position of this group or object.
ATransformable
 Inherited
hasParent():Boolean
Tests if this node has a parent.
Node
  
initFrame():void
Initiates the local coordinate system for this object.
ATransformable
 Inherited
isParent(p_oNode:Node):Boolean
Tests if the node passed in the argument is parent of this node.
Node
  
lookAt(p_nX:Number, p_nY:Number, p_nZ:Number):void
Makes this object "look at" the specified position in the parent frame.
ATransformable
  
moveForward(p_nD:Number):void
Translates this object along its forward vector ( local z ) in the parent frame.
ATransformable
  
moveHorizontally(p_nD:Number):void
Translates this object parallel to its parent zx plane and in its forward direction.
ATransformable
  
moveLateraly(p_nD:Number):void
Translates this object laterally in its parent frame.
ATransformable
  
moveSideways(p_nD:Number):void
Translates this object along its side vector ( local x ) in the parent frame.
ATransformable
  
moveUpwards(p_nD:Number):void
Translates this object along its up vector ( local y ) in the parent frame.
ATransformable
  
moveVertically(p_nD:Number):void
Translates this object vertically in ots parent frame.
ATransformable
 Inherited
remove():void
Removes this node from the node tree, saving its child nodes.
Node
 Inherited
removeChildById(p_nId:Number):Boolean
Removes the child node with the specified id.
Node
 Inherited
removeChildByName(p_sName:String):Boolean
Removes the child node with the specified name.
Node
 Inherited
removeEventListener(p_sEvt:String, p_oL:*):void
Removes a listener for the specified event.
Node
 Inherited
render(p_oScene:Scene3D, p_oCamera:Camera3D):void
Renders this node.
Node
  
rotateAxis(p_nX:Number, p_nY:Number, p_nZ:Number, p_nAngle:Number):void
Rotate this object around the specified axis in the parent frame by the specified angle.
ATransformable
  
setPosition(p_nX:Number, p_nY:Number, p_nZ:Number):void
Sets the position of this object in coordinates of its parent frame.
ATransformable
 Inherited
swapParent(p_oNewParent:Node):void
Moves this node to another parent node.
Node
  
toString():String
Returns a string representation of this object
ATransformable
  
translate(p_nX:Number, p_nY:Number, p_nZ:Number):void
Translate this object from it's current position with the specified offsets.
ATransformable
  
update(p_oScene:Scene3D, p_oModelMatrix:Matrix4, p_bChanged:Boolean):void
Updates this node or object.
ATransformable
  
Updates the transform matrix of the current object/node before it is rendered.
ATransformable
Public Constants
 ConstantDefined by
 Inheritedid : uint
The unique id of this node in the node graph.
Node
Property detail
disableproperty
public var disable:Boolean = false

Disable the local transformations applied to this Node if set to false. They will be applied back once et back to true.

matrixproperty 
matrix:Matrix4  [read-write]Implementation
    public function get matrix():Matrix4
    public function set matrix(value:Matrix4):void
m_oPreviousOffsetRotationproperty 
protected var m_oPreviousOffsetRotation:Vector
m_tmpMtproperty 
protected var m_tmpMt:Matrix4
_oScaleproperty 
protected var _oScale:Vector
outproperty 
out:Vector  [read-only]

Forward direction ( local z ) in parent coordinates.

Implementation
    public function get out():Vector
_pproperty 
protected var _p:Vector
panproperty 
pan:Number  [read-write]

Pans this object around the local y axis.

The pan angle interval is 0 to 360 degrees
Directions within the parent frame are: North = 0, East = 90, South = 180 nad West = 270 degrees.

Implementation
    public function get pan():Number
    public function set pan(value:Number):void
rollproperty 
roll:Number  [read-write]

Rolls this object around the local z axis.

The roll angle interval is -180 to +180 degrees
At 0 degrees the local x axis is aligned with the horizon of its parent
Full roll right = 180 and full roll left = -180 degrees ( upside down ).

Implementation
    public function get roll():Number
    public function set roll(value:Number):void
rotateXproperty 
rotateX:Number  [read-write]

Rotates this object around an axis parallel to the parents x axis.

The object rotates a specified angle ( degrees ) around an axis through the objects reference point, paralell to the x axis of the parent frame.

Implementation
    public function get rotateX():Number
    public function set rotateX(value:Number):void
rotateYproperty 
rotateY:Number  [read-write]

Rotates this object around an axis parallel to the parents y axis.

The object rotates a specified angle ( degrees ) around an axis through the objects reference point, parallel to the y axis of the parent frame.

Implementation
    public function get rotateY():Number
    public function set rotateY(value:Number):void
rotateZproperty 
rotateZ:Number  [read-write]

Rotates this object around an axis paralell to the parents z axis.

The object rotates a specified angle ( degrees ) around an axis through the objects reference point, paralell to the z axis of the parent frame.

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

x scale of this object.

A value of 1 scales to the original x scale, a value of 2 doubles the x scale.
NOTE : This value does not affect the camera object.

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

y scale of this object.

A value of 1 scales to the original y scale, a value of 2 doubles the y scale.
NOTE : This value does not affect the camera object.

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

z scale of this object.

A value of 1 scales to the original z scale, a value of 2 doubles the z scale.
NOTE : This value does not affect the camera object.

Implementation
    public function get scaleZ():Number
    public function set scaleZ(value:Number):void
sideproperty 
side:Vector  [read-only]

Side direction ( local x ) in parent coordinates.

Implementation
    public function get side():Vector
targetproperty 
target:Vector  [write-only]

The position in the parent frame this object should "look at".

Useful for following a moving object or a static object while this object is moving.
Normally used when this object is a camera

Implementation
    public function set target(value:Vector):void
tiltproperty 
tilt:Number  [read-write]

Getter for the tilt value

Implementation
    public function get tilt():Number
    public function set tilt(value:Number):void
upproperty 
up:Vector  [read-only]

Up direction ( local y ) in parent coordinates.

Implementation
    public function get up():Vector
_vOutproperty 
protected var _vOut:Vector
_vSideproperty 
protected var _vSide:Vector
_vUpproperty 
protected var _vUp:Vector
xproperty 
x:Number  [read-write]

x position of this object in its parent frame.

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

y position of this object in its parent frame.

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

z position of the node in its parent frame.

Implementation
    public function get z():Number
    public function set z(value:Number):void
Constructor detail
ATransformable()constructor
public function ATransformable(p_sName:String = "")

Creates a transformable node in the object tree of the world.

This constructor should normally not be called directly, but from a sub class.

Parameters
p_sName:String (default = "") — A string identifier for this object
Method detail
getPosition()method
public function getPosition(p_sMode:String = "local"):Vector

Returns the position of this group or object.

Choose which coordinate system the returned position refers to, by passing a mode string:
The position is returned as a vector in one of the following:
If "local", the position is coordinates of the parent frame. If "absolute" the position is in world coordinates If "camera" the position is relative to the camera's coordinate system. Default value is "local" Parameters

p_sMode:String (default = "local")

Returns
Vector — The position of the group or object
initFrame()method 
public function initFrame():void

Initiates the local coordinate system for this object.

The local coordinate system for this object is set parallell the parent system.

lookAt()method 
public function lookAt(p_nX:Number, p_nY:Number, p_nZ:Number):void

Makes this object "look at" the specified position in the parent frame.

Useful for following a moving object or a static object while this object is moving.
Normally used when this object is a camera

Parameters
p_nX:Number — Number The x position to look at
 
p_nY:Number — Number The y position to look at
 
p_nZ:Number — Number The z position to look at
moveForward()method 
public function moveForward(p_nD:Number):void

Translates this object along its forward vector ( local z ) in the parent frame.

If you imagine yourself in the world, it would be a step forward
in the direction you look, not always horizontally!

Parameters
p_nD:Number — How far to move
moveHorizontally()method 
public function moveHorizontally(p_nD:Number):void

Translates this object parallel to its parent zx plane and in its forward direction.

If you imagine yourself in the world, it would be a step in the forward direction, but without changing your altitude ( constant global z ).

Parameters
p_nD:Number — How far to move
moveLateraly()method 
public function moveLateraly(p_nD:Number):void

Translates this object laterally in its parent frame.

This is a translation in the parents x direction.

Parameters
p_nD:Number — How far to move
moveSideways()method 
public function moveSideways(p_nD:Number):void

Translates this object along its side vector ( local x ) in the parent frame.

If you imagine yourself in the world, it would be a step to your right or to your left

Parameters
p_nD:Number — How far to move
moveUpwards()method 
public function moveUpwards(p_nD:Number):void

Translates this object along its up vector ( local y ) in the parent frame.

If you imagine yourself in the world, it would be a step up or down
in the direction of your body, not always vertically!

Parameters
p_nD:Number — How far to move
moveVertically()method 
public function moveVertically(p_nD:Number):void

Translates this object vertically in ots parent frame.

If you imagine yourself in the world, it would be a strictly vertical step, ( in the global y direction )

Parameters
p_nD:Number — How far to move
rotateAxis()method 
public function rotateAxis(p_nX:Number, p_nY:Number, p_nZ:Number, p_nAngle:Number):void

Rotate this object around the specified axis in the parent frame by the specified angle.

NOTE : The axis will be normalized automatically.

Parameters
p_nX:Number — The x coordinate of the axis
 
p_nY:Number — The y coordinate of the axis
 
p_nZ:Number — The z coordinate of the axis
 
p_nAngle:Number — The angle of rotation in degrees.
setPosition()method 
public function setPosition(p_nX:Number, p_nY:Number, p_nZ:Number):void

Sets the position of this object in coordinates of its parent frame.

Parameters
p_nX:Number — The x coordinate
 
p_nY:Number — The y coordiante
 
p_nZ:Number — The z coordiante
toString()method 
public override function toString():String

Returns a string representation of this object

Returns
String — The fully qualified name of this class
translate()method 
public function translate(p_nX:Number, p_nY:Number, p_nZ:Number):void

Translate this object from it's current position with the specified offsets.

Parameters
p_nX:Number — Offset that will be added to the x coordinate of the object
 
p_nY:Number — Offset that will be added to the y coordinate of the object
 
p_nZ:Number — Offset that will be added to the z coordinate of the object
update()method 
public override function update(p_oScene:Scene3D, p_oModelMatrix:Matrix4, p_bChanged:Boolean):void

Updates this node or object.

For node's with transformation, this method updates the transformation taking into account the matrix cache system.
FIXME: Transformable nodes shall upate their transform if necessary before calling this method.

Parameters
p_oScene:Scene3D — The current scene
 
p_oModelMatrix:Matrix4 — The matrix which represents the parent model matrix. Basically it stores the rotation/translation/scale of all the nodes above the current one.
 
p_bChanged:Boolean — A boolean value which specify if the state has changed since the previous rendering. If false, we save some matrix multiplication process.
updateTransform()method 
public function updateTransform():void

Updates the transform matrix of the current object/node before it is rendered.