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

new()

Creates an Object3D object.

Variables

read onlybackVector:Vector3D

read onlydownVector:Vector3D

eulers:Vector3D

extra:Dynamic

An object that can contain any extra data.

read onlyforwardVector:Vector3D

read onlyleftVector:Vector3D

pivotPoint:Vector3D

position:Vector3D

read onlyrightVector:Vector3D

rotationX:Float

rotationY:Float

rotationZ:Float

scaleX:Float

scaleY:Float

scaleZ:Float

transform:Matrix3D

read onlyupVector:Vector3D

x:Float

y:Float

z:Float

Methods

dispose():Void

Cleans up any resources used by the current object.

disposeAsset():Void

@inheritDoc

@:value({ v : null })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

@:value({ upAxis : null })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

Inherited Variables

Defined by NamedAssetBase

read onlyassetFullPath:Array<Dynamic>

read onlyassetNamespace:String

id:String

name:String

read onlyoriginalName:String

Inherited Methods

Defined by NamedAssetBase

assetPathEquals(name:String, ns:String):Bool

@:value({ overrideOriginal : true, ns : null })resetAssetPath(name:String, ?ns:String, overrideOriginal:Bool = true):Void