| Package | sandy.core.scenegraph |
| Class | public class ATransformable |
| Inheritance | ATransformable Node |
| Subclasses | Camera3D, Shape3D, Sprite2D, Sprite3D, TransformGroup |
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.
| Property | Defined by | ||
|---|---|---|---|
![]() | boundingBox : BBox
The bounding box of this node
IMPORTANT: Do not modify it unless you perfectly know what you are doing
| Node | |
![]() | boundingSphere : BSphere
The bounding sphere of this node
IMPORTANT: Do not modify it unless you perfectly know what you are doing
| Node | |
![]() | broadcaster : BubbleEventBroadcaster
The broadcaster
The broadcaster is used to send events to listeners. | Node | |
![]() | changed : Boolean = false
This property set the cache status of the current node.
| Node | |
![]() | children : Array
The children of this node are stored inside this array.
| Node | |
![]() | culled : 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 | ||
![]() | modelMatrix : Matrix4
Cached matrix corresponding to the transformation to the 0,0,0 frame system
| Node | |
![]() | name : 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 | ||
![]() | parent : 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 | ||
![]() | scene : 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 | ||
![]() | viewMatrix : Matrix4
Cached matrix corresponding to the transformation to the camera frame system
| Node | |
![]() | visible : 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 | ||
| Property | Defined by | ||
|---|---|---|---|
![]() | m_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 | ||
| Method | Defined by | ||
|---|---|---|---|
|
ATransformable(p_sName:String = "")
Creates a transformable node in the object tree of the world.
| ATransformable | ||
![]() |
Adds a new child to this node.
| Node | |
![]() |
addEventListener(p_sEvt:String, p_oL:*):void
Adds a listener for the specified event.
| Node | |
![]() |
Tests this node against the frustum volume to get its visibility.
| Node | |
![]() |
destroy():void
Delete this node and all its child nodes.
| Node | |
![]() |
getChildByName(p_sName:String, p_bRecurs:Boolean = false):Node
Returns the child node with the specified name.
| Node | |
![]() |
getChildFromId(p_nId:uint, p_bRecurs:Boolean = false):Node
Returns the child node with the specified id.
| Node | |
![]() |
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 | ||
![]() |
hasParent():Boolean
Tests if this node has a parent.
| Node | |
|
initFrame():void
Initiates the local coordinate system for this object.
| ATransformable | ||
![]() |
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 | ||
![]() |
remove():void
Removes this node from the node tree, saving its child nodes.
| Node | |
![]() |
removeChildById(p_nId:Number):Boolean
Removes the child node with the specified id.
| Node | |
![]() |
removeChildByName(p_sName:String):Boolean
Removes the child node with the specified name.
| Node | |
![]() |
removeEventListener(p_sEvt:String, p_oL:*):void
Removes a listener for the specified event.
| Node | |
![]() |
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 | ||
![]() |
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 | ||
|
Updates this node or object.
| ATransformable | ||
|
updateTransform():void
Updates the transform matrix of the current object/node before it is rendered.
| ATransformable | ||
| disable | property |
public var disable:Boolean = falseDisable the local transformations applied to this Node if set to false. They will be applied back once et back to true.
| matrix | property |
matrix:Matrix4 [read-write]Implementation
public function get matrix():Matrix4
public function set matrix(value:Matrix4):void
| m_oPreviousOffsetRotation | property |
protected var m_oPreviousOffsetRotation:Vector
| m_tmpMt | property |
protected var m_tmpMt:Matrix4
| _oScale | property |
protected var _oScale:Vector
| out | property |
out:Vector [read-only]Forward direction ( local z ) in parent coordinates.
Implementation public function get out():Vector
| _p | property |
protected var _p:Vector
| pan | property |
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.
public function get pan():Number
public function set pan(value:Number):void
| roll | property |
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 ).
public function get roll():Number
public function set roll(value:Number):void
| rotateX | property |
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
| rotateY | property |
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
| rotateZ | property |
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
| scaleX | property |
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.
public function get scaleX():Number
public function set scaleX(value:Number):void
| scaleY | property |
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.
public function get scaleY():Number
public function set scaleY(value:Number):void
| scaleZ | property |
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.
public function get scaleZ():Number
public function set scaleZ(value:Number):void
| side | property |
side:Vector [read-only]Side direction ( local x ) in parent coordinates.
Implementation public function get side():Vector
| target | property |
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
public function set target(value:Vector):void
| tilt | property |
tilt:Number [read-write]Getter for the tilt value
Implementation public function get tilt():Number
public function set tilt(value:Number):void
| up | property |
up:Vector [read-only]Up direction ( local y ) in parent coordinates.
Implementation public function get up():Vector
| _vOut | property |
protected var _vOut:Vector
| _vSide | property |
protected var _vSide:Vector
| _vUp | property |
protected var _vUp:Vector
| x | property |
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
| y | property |
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
| z | property |
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
| 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.
Parametersp_sName:String (default = "") — A string identifier for this object
|
| getPosition | () | method |
public function getPosition(p_sMode:String = "local"):VectorReturns 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") |
Vector —
The position of the group or object
|
| initFrame | () | method |
public function initFrame():voidInitiates 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):voidMakes 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
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):voidTranslates 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!
p_nD:Number — How far to move
|
| moveHorizontally | () | method |
public function moveHorizontally(p_nD:Number):voidTranslates 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 ).
Parametersp_nD:Number — How far to move
|
| moveLateraly | () | method |
public function moveLateraly(p_nD:Number):voidTranslates this object laterally in its parent frame.
This is a translation in the parents x direction.
Parametersp_nD:Number — How far to move
|
| moveSideways | () | method |
public function moveSideways(p_nD:Number):voidTranslates 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
Parametersp_nD:Number — How far to move
|
| moveUpwards | () | method |
public function moveUpwards(p_nD:Number):voidTranslates 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!
p_nD:Number — How far to move
|
| moveVertically | () | method |
public function moveVertically(p_nD:Number):voidTranslates 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 )
Parametersp_nD:Number — How far to move
|
| rotateAxis | () | method |
public function rotateAxis(p_nX:Number, p_nY:Number, p_nZ:Number, p_nAngle:Number):voidRotate this object around the specified axis in the parent frame by the specified angle.
NOTE : The axis will be normalized automatically.
Parametersp_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):voidSets the position of this object in coordinates of its parent frame.
Parametersp_nX:Number — The x coordinate
|
|
p_nY:Number — The y coordiante
|
|
p_nZ:Number — The z coordiante
|
| toString | () | method |
public override function toString():StringReturns a string representation of this object
ReturnsString — The fully qualified name of this class
|
| translate | () | method |
public function translate(p_nX:Number, p_nY:Number, p_nZ:Number):voidTranslate this object from it's current position with the specified offsets.
Parametersp_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):voidUpdates 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.
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():voidUpdates the transform matrix of the current object/node before it is rendered.