class Object3D
package away3d.core.base
extends NamedAssetBase
extended by ObjectContainer3D
Available on all platforms
Object3D provides a base class for any 3D object that has a (local) transformation.
Standard Transform:
<li> The standard order for transformation is [parent transform] * (Translate+Pivot) * (Rotate) * (-Pivot) * (Scale) * [child transform] </li>
<li> This is the order of matrix multiplications, left-to-right. </li>
<li> The order of transformation is right-to-left, however!
(Scale) happens before (-Pivot) happens before (Rotate) happens before (Translate+Pivot)
with no pivot, the above transform works out to [parent transform] * Translate * Rotate * Scale * [child transform]
(Scale) happens before (Rotate) happens before (Translate) </li>
<li> This is based on code in updateTransform and ObjectContainer3D.updateSceneTransform(). </li>
<li> Matrix3D prepend = operator on rhs - e.g. transform' = transform * rhs; </li>
<li> Matrix3D append = operator on lhr - e.g. transform' = lhs * transform; </li>
To affect Scale:
<li> set scaleX/Y/Z directly, or call scale(delta) </li>
To affect Pivot:
<li> set pivotPoint directly, or call movePivot() </li>
To affect Rotate:
- set rotationX/Y/Z individually (using degrees), set eulers [all 3 angles] (using radians), or call rotateTo()
- call pitch()/yaw()/roll()/rotate() to add an additional rotation before the current transform.
rotationX/Y/Z will be reset based on these operations. </li>
To affect Translate (post-rotate translate):
- set x/y/z/position or call moveTo().
- call translate(), which modifies x/y/z based on a delta vector.
- call moveForward()/moveBackward()/moveLeft()/moveRight()/moveUp()/moveDown()/translateLocal() to add an additional translate *before* the current transform. x/y/z will be reset based on these operations.
Constructor
Variables
Methods
getPosition(?v:Vector3D):Vector3D
Defines the position of the 3d object, relative to the local coordinates of the parent ObjectContainer3D.
@return
Parameters:
v | the destination Vector3D |
|---|
lookAt(target:Vector3D, ?upAxis:Vector3D):Void
Rotates the 3d object around to face a point defined relative to the local coordinates of the parent ObjectContainer3D.
Parameters:
target | The vector defining the point to be looked at |
|---|---|
upAxis | An optional vector used to define the desired up orientation of the 3d object after rotation has occurred |
moveBackward(distance:Float):Void
Moves the 3d object backwards along it's local z axis
Parameters:
distance | The length of the movement |
|---|
moveDown(distance:Float):Void
Moves the 3d object backwards along it's local y axis
Parameters:
distance | The length of the movement |
|---|
moveForward(distance:Float):Void
Moves the 3d object forwards along it's local z axis
Parameters:
distance | The length of the movement |
|---|
moveLeft(distance:Float):Void
Moves the 3d object backwards along it's local x axis
Parameters:
distance | The length of the movement |
|---|
movePivot(dx:Float, dy:Float, dz:Float):Void
Moves the local point around which the object rotates.
Parameters:
dx | The amount of movement along the local x axis. |
|---|---|
dy | The amount of movement along the local y axis. |
dz | The amount of movement along the local z axis. |
moveRight(distance:Float):Void
Moves the 3d object forwards along it's local x axis
Parameters:
distance | The length of the movement |
|---|
moveTo(dx:Float, dy:Float, dz:Float):Void
Moves the 3d object directly to a point in space
Parameters:
dx | The amount of movement along the local x axis. |
|---|---|
dy | The amount of movement along the local y axis. |
dz | The amount of movement along the local z axis. |
moveUp(distance:Float):Void
Moves the 3d object forwards along it's local y axis
Parameters:
distance | The length of the movement |
|---|
pitch(angle:Float):Void
Rotates the 3d object around it's local x-axis
Parameters:
angle | The amount of rotation in degrees |
|---|
roll(angle:Float):Void
Rotates the 3d object around it's local z-axis
Parameters:
angle | The amount of rotation in degrees |
|---|
rotate(axis:Vector3D, angle:Float):Void
Rotates the 3d object around an axis by a defined angle
Parameters:
axis | The vector defining the axis of rotation |
|---|---|
angle | The amount of rotation in degrees |
rotateTo(ax:Float, ay:Float, az:Float):Void
Rotates the 3d object directly to a euler angle
Parameters:
ax | The angle in degrees of the rotation around the x axis. |
|---|---|
ay | The angle in degrees of the rotation around the y axis. |
az | The angle in degrees of the rotation around the z axis. |
scale(value:Float):Void
Appends a uniform scale to the current transformation.
Parameters:
value | The amount by which to scale. |
|---|
translate(axis:Vector3D, distance:Float):Void
Moves the 3d object along a vector by a defined length
Parameters:
axis | The vector defining the axis of movement |
|---|---|
distance | The length of the movement |
translateLocal(axis:Vector3D, distance:Float):Void
Moves the 3d object along a vector by a defined length
Parameters:
axis | The vector defining the axis of movement |
|---|---|
distance | The length of the movement |
yaw(angle:Float):Void
Rotates the 3d object around it's local y-axis
Parameters:
angle | The amount of rotation in degrees |
|---|