API Documentation

for 0.0.1
Show:

Transform Class

Transform class is meant to be aggregated to any object that needs to be transformed in space. Mesh, Light or Camera contains a transform instance.

Constructor

Transform

()

Methods

addChild

(
  • child
)

Adds a child to this transform (argument must be a transform too)

Parameters:

getChild

(
  • index
)
Object

Gets one of all the children objects of this transform

Parameters:

  • index Number

    Index of the child to get

Returns:

Object:

getChildren

() Array

Gets an array containning all the children objects of this transform

Returns:

Array:

getDirections

() Object

Get the 3 direction vectors of this transform

Returns:

Object:

object with all 3 Vector3 as {upVector: upVector, forwardVector: forwardVector,leftVector: leftVector};

getLocalPosition

() Vector3

Gets the local position of this transform

Returns:

Vector3:

localPosition vector

getLocalPositionX

() Number

Gets the local x position of this transform

Returns:

Number:

localPosition x

getLocalPositionY

() Number

Gets the local x position of this transform

Returns:

Number:

localPosition y

getLocalPositionZ

() Number

Gets the local z position of this transform

Returns:

Number:

localPosition z

getLocalQuaternion

() Quaternion

Get the object rotation as a quarternion.

Returns:

Quaternion:

quarternion

getLocalRotation

() Vector3

Get the current local rotation of this transform

Returns:

Vector3:

localRotation vector

getLocalRotationX

() Number

Get the current x local rotation of this transform

Returns:

Number:

localRotation x value

getLocalRotationY

() Number

Get the current y local rotation of this transform

Returns:

Number:

localRotation y value

getLocalRotationZ

() Number

Get the current z local rotation of this transform

Returns:

Number:

localRotation z value

getLocalScale

() Vector3

Returns:

Vector3:

localScale vector

getLocalScaleX

() Number

Returns:

Number:

localScale x

getLocalScaleY

() Number

Returns:

Number:

localScale y

getLocalScaleZ

() Number

Returns:

Number:

localScale z

getScreenCoordinates

(
  • context
  • camera
)
Vector2

Return a Vector2 giving the screen coordinates of the object

Parameters:

  • context Context

    the current Mobilizing context

  • camera Camera

    the Camera to use for the projection

Returns:

Vector2:

the screen coordinates of the object

getWorldPosition

() Vector3

Returns:

Vector3:

worlPosition vector of the object

lookAt

(
  • vector
)

Geneates a transform to point at a certain coordinates, makes the object "look at" this point.

Parameters:

  • vector Vector

pick

(
  • cam
  • x
  • y
)
Object

Perform a RayCast picking

Parameters:

  • cam Camera

    The camera to use as a ray caster.

  • x Number

    The x coordinate in screen space for the ray casting

  • y Number

    The y coordinate in screen space for the ray casting

Returns:

Object:

if picking success, gives an object as {point:{x,y,z}, uv:{u,v}, distance:dist}, null otherwise.

removeChild

(
  • child
)

Removes a child from the children chain

Parameters:

  • child Object

setLocalPosition

(
  • number|Vector3|Vector2
  • Number
  • Number
)

Set the local position of the transform (and to the object attach to it). Polymorphic : can take various agruments of various types. Possible arguments number is 1, 2 or 3.

Parameters:

  • number|Vector3|Vector2 Float | Vector3 | Vector2

    Value for the new position of the transform. If a Vector3 is given, its x, y, z will be used for the position x, y, z. If a Vector2 is given, its x, y will be used for the position x and y, but z will be unchanged. If a number is given, it will be the position x.

  • Number Float

    Value for the new y position of the transform.

  • Number Float

    Value for the new z position of the transform.

setLocalPositionX

(
  • arg
)

Sets this transform's x position

Parameters:

  • arg Number

setLocalPositionY

(
  • arg
)

Sets this transform's y position

Parameters:

  • arg Number

setLocalPositionZ

(
  • arg
)

Sets this transform's z position

Parameters:

  • arg Number

setLocalQuaternion

(
  • quarternion
)

Set the object rotation with a quarternion {x,y,z,w}.

Parameters:

setLocalRotation

(
  • number|Vector3|Vector2
  • Number
  • Number
)

Set the euler angles rotation in degrees. Polymorphic : can take various agruments of various types. Possible arguments number is 1, 2 or 3.

Parameters:

  • number|Vector3|Vector2 Float | Vector3 | Vector2

    Value for the new rotation of the transform. If a Vector3 is given, its x, y, z will be used for the rotation x, y, z. If a Vector2 is given, its x, y will be used for the rotation x and y, but z will be unchanged. If a number is given, it will be the position x.

  • Number Float

    Value for the new y rotation of the transform.

  • Number Float

    Value for the new z rotation of the transform.

setLocalRotationOrder

(
  • order
)

Defines the oreder of application for rotation axis. Default is 'XYZ', others are'YZX', 'ZXY', 'XZY', 'YXZ' and 'ZYX'

Parameters:

  • order String

    one of 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ' and 'ZYX'

setLocalRotationX

(
  • arg
)

Sets this transform's x rotation

Parameters:

  • arg Number

setLocalRotationY

(
  • arg
)

Sets this transform's y rotation

Parameters:

  • arg Number

setLocalRotationZ

(
  • arg
)

Sets this transform's z rotation

Parameters:

  • arg Number

setLocalScale

(
  • number|Vector3|Vector2
  • Number
  • Number
)

Set the scale of the transform. Polymorphic : can take various agruments of various types. Possible arguments number is 1, 2 or 3.

Parameters:

  • number|Vector3|Vector2 Float | Vector3 | Vector2

    Value for the new scale. If a Vector3 is given, its x, y, z will be used for the scale x, y, z. If a Vector2 is given, its x, y will be used for the scale x and y, but z will be 1. If a number is given, it will be the scale x.

  • Number Float

    Value for the new y scale.

  • Number Float

    Value for the new z scale.

setLocalScaleX

(
  • arg
)

Sets this transform's x scale

Parameters:

  • arg Number

setLocalScaleY

(
  • arg
)

Sets this transform's y scale

Parameters:

  • arg Number

setLocalScaleZ

(
  • arg
)

Sets this transform's z scale

Parameters:

  • arg Number

setRenderOrder

()

Sets the render order of this object. The sortObjects of the renderer should be true for this property to have any effect.