Constructor

new(object:Object)

Variables

dim:Vec4

The dimensions of the object in local space (without parent, prepended or appended matrices applied).

dirty:Bool

Flag to rebuild the world matrix on next update.

loc:Vec4

The local translation. Changes to this field should be applied by calling buildMatrix().

local:Mat4

The local matrix. If you modify this, call decompose() to update the loc, rot and scale fields, or buildMatrix() to update everything.

@:value(false)localOnly:Bool = false

Prevent applying parent matrix.

object:Object

The object that is effected by this transform.

radius:FastFloat

The radius of the smallest sphere that encompasses the object in local space.

rot:Quat

The local rotation. Changes to this field should be applied by calling buildMatrix().

scale:Vec4

The local scale. Changes to this field should be applied by calling buildMatrix().

@:value(1.0)scaleWorld:FastFloat = 1.0

Uniform scale factor for world matrix.

world:Mat4

The world matrix (read-only).

worldUnpack:Mat4

The world matrix with scaleWorld applied (read-only).

Methods

buildMatrix():Void

Update the transform matrix based on loc, rot, and scale. If any change is made to loc, rot, or scale buildMatrix() must be called to update the objects transform.

decompose():Void

Update the loc, rot and scale fields according to the local matrix. You may need to call this after directly mutating the local matrix.

diff():Bool

Check whether the transform has changed at all since the last time this function was called.

Returns:

true if the transform has changed.

inlinelook():Vec4

Returns:

The look vector (positive local y axis) in world space.

@:value({ f : 1.0 })move(axis:Vec4, f:Float = 1.0):Void

Apply a scaled translation in local space.

Parameters:

axis

The direction to move.

f

A multiplier for the movement. If axis is a unit vector, then this is the distance to move.

multMatrix(mat:Mat4):Void

Apply another transform to this one, i.e. multiply this transform's local matrix by another.

Parameters:

mat

The other transform to apply.

reset():Void

Reset to a null transform: zero location and rotation, and a uniform scale of one. Other fields such as prepended matrices and bone parents will not be changed.

inlineright():Vec4

Returns:

The right vector (positive local x axis) in world space.

rotate(axis:Vec4, f:FastFloat):Void

Rotate around an axis.

Parameters:

axis

The axis to rotate around.

f

The magnitude of the rotation in radians.

setMatrix(mat:Mat4):Void

Set the local matrix and update loc, rot, scale and world.

Parameters:

mat

The new local matrix.

setRotation(x:FastFloat, y:FastFloat, z:FastFloat):Void

Set the rotation of the object in radians.

Parameters:

x

Set the x axis rotation in radians.

y

Set the y axis rotation in radians.

z

Set the z axis rotation in radians.

translate(x:FastFloat, y:FastFloat, z:FastFloat):Void

Move the game Object by the defined amount relative to its current location.

Parameters:

x

Amount to move on the local x axis.

y

Amount to move on the local y axis.

z

Amount to move on the local z axis.

inlineup():Vec4

Returns:

The up vector (positive local z axis) in world space.

update():Void

Rebuild the matrices, if needed.

inlineworldx():FastFloat

Returns:

The world x location.

inlineworldy():FastFloat

Returns:

The world y location.

inlineworldz():FastFloat

Returns:

The world z location.