Description

Controls the position, rotation, and scale of a SceneObject. Every SceneObject automatically has a Transform attached.

Example

// Move attached Transform 1 unit up
var transform = script.getTransform();
var pos = transform.getWorldPosition();
pos.y += 1;
transform.setWorldPosition(pos);
// Bind to "Frame Updated" to rotate the object every frame
var transform = script.getTransform();
var rotation = transform.getLocalRotation();
var rotateBy = quat.angleAxis(Math.PI*getDeltaTime(), vec3.up());
rotation = rotation.multiply(rotateBy);
transform.setLocalRotation(rotation);
interface Transform {
    back: vec3;
    down: vec3;
    forward: vec3;
    left: vec3;
    right: vec3;
    up: vec3;
    getInvertedWorldTransform(): mat4;
    getLocalPosition(): vec3;
    getLocalRotation(): quat;
    getLocalScale(): vec3;
    getSceneObject(): SceneObject;
    getTypeName(): string;
    getWorldPosition(): vec3;
    getWorldRotation(): quat;
    getWorldScale(): vec3;
    getWorldTransform(): mat4;
    isOfType(type): boolean;
    isSame(other): boolean;
    setLocalPosition(pos): void;
    setLocalRotation(rotation): void;
    setLocalScale(scale): void;
    setLocalTransform(transformMat): void;
    setWorldPosition(pos): void;
    setWorldRotation(rotation): void;
    setWorldScale(scale): void;
    setWorldTransform(transformMat): void;
}

Hierarchy (view full)

Properties

back: vec3

Description

Returns the Transform's back directional vector.

down: vec3

Description

Returns the Transform's down directional vector.

forward: vec3

Description

Returns the Transform's forward directional vector.

left: vec3

Description

Returns the Transform's left directional vector.

right: vec3

Description

Returns the Transform's right directional vector.

up: vec3

Description

Returns the Transform's up directional vector.

Methods

  • Returns mat4

    Description

    Returns the Transform's world-to-local transformation matrix.

  • Returns vec3

    Description

    Returns the Transform's position relative to its parent.

  • Returns quat

    Description

    Returns the Transform's rotation relative to its parent.

  • Returns vec3

    Description

    Returns the Transform's scale relative to its parent.

  • Returns SceneObject

    Description

    Returns the SceneObject the Transform is attached to.

  • Returns string

    Description

    Returns the name of this object's type.

  • Returns vec3

    Description

    Returns the Transform's position relative to the world.

  • Returns quat

    Description

    Returns the Transform's rotation relative to the world.

  • Returns vec3

    Description

    Returns the Transform's scale relative to the world.

  • Returns mat4

    Description

    Returns the Transform's local-to-world transformation matrix.

  • Parameters

    • type: string

    Returns boolean

    Description

    Returns true if the object matches or derives from the passed in type.

  • Parameters

    Returns boolean

    Description

    Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

  • Parameters

    Returns void

    Description

    Sets the Transform's position relative to its parent.

  • Parameters

    Returns void

    Description

    Sets the Transform's rotation relative to its parent.

  • Parameters

    Returns void

    Description

    Sets the Transform's scale relative to its parent.

  • Parameters

    Returns void

    Description

    Sets the Transform's local transformation matrix.

  • Parameters

    Returns void

    Description

    Sets the Transform's position relative to the world.

  • Parameters

    Returns void

    Description

    Sets the Transform's rotation relative to the world.

  • Parameters

    Returns void

    Description

    Sets the Transform's scale relative to the world. This may produce lossy results when parent objects are rotated, so use setLocalScale() instead if possible.

  • Parameters

    Returns void

    Description

    Sets the Transform's transformation matrix.

Generated using TypeDoc