import Transform from '@mobilizing/library/js/Mobilizing/renderer/3D/three/scene/Transform.js'
Transform
Constructor Summary
Public Constructor | ||
public | Transform class is meant to be aggregated to any object that needs to be transformed in space. |
Member Summary
Public Members | ||
public | children: *[] | |
public | mobObject: * | |
public | nativeObject: * | |
public | recursiveChildren: *[] |
Method Summary
Public Methods | ||
public | addChild(child: Transform Mesh) Adds a child to this transform (argument must be a transform too) | |
public | addChildren(child: Array) Adds a children array to this transform (argument must be a transform too) | |
public | Gets one of all the children objects of this transform | |
public | getChildren(recursive: *): Array Gets an array containning all the children objects of this transform | |
public | Get the 3 direction vectors of this transform | |
public | getLocalEulerAngles(): * | |
public | ||
public | Gets the local position of this transform | |
public | Gets the local x position of this transform | |
public | Gets the local x position of this transform | |
public | Gets the local z position of this transform | |
public | Get the object rotation as a quarternion. | |
public | Get the current local rotation of this transform | |
public | Get the current x local rotation of this transform | |
public | Get the current y local rotation of this transform | |
public | Get the current z local rotation of this transform | |
public | ||
public | ||
public | ||
public | ||
public | getNativeObject(): * | |
public | getParent(): * | |
public | getRecurseChildren(transform: *) | |
public | getScreenCoordinates(context: Context, camera: Camera): Vector2 Return a Vector2 giving the screen coordinates of the object | |
public | getVisible(): * | |
public | getWorldMatrix(): * get the world matrix of the object | |
public | ||
public | getWorldQuaternion(): * get the world quaternion of the object | |
public | lookAt(vector: Vector) Geneates a transform to point at a certain coordinates, makes the object "look at" this point. | |
public | Perform a RayCast picking | |
public | removeChild(child: Transform) Removes a child from the children chain | |
public | setLocalEulerAngles(arg1: *, arg2: *, arg3: *) | |
public | setLocalMatrix(m: *) | |
public | setLocalPosition(number|Vector3|Vector2: float | Vector3 | Vector2, Number: float, Number: float) Set the local position of the transform (and to the object attach to it). | |
public | setLocalPositionX(arg: Number) Sets this transform's x position | |
public | setLocalPositionY(arg: Number) Sets this transform's y position | |
public | setLocalPositionZ(arg: Number) Sets this transform's z position | |
public | setLocalQuaternion(quarternion: Quaternion) Set the object rotation with a quarternion {x,y,z,w}. | |
public | setLocalRotation(number|Vector3|Vector2: float | Vector3 | Vector2, Number: float, Number: float) Set the euler angles rotation in degrees. | |
public | setLocalRotationOrder(order: string) Defines the oreder of application for rotation axis. | |
public | setLocalRotationX(arg: Number) Sets this transform's x rotation | |
public | setLocalRotationY(arg: Number) Sets this transform's y rotation | |
public | setLocalRotationZ(arg: Number) Sets this transform's z rotation | |
public | setLocalScale(number|Vector3|Vector2: float | Vector3 | Vector2, Number: float, Number: float) Set the scale of the transform. | |
public | setLocalScaleX(arg: Number) Sets this transform's x scale | |
public | setLocalScaleY(arg: Number) Sets this transform's y scale | |
public | setLocalScaleZ(arg: Number) Sets this transform's z scale | |
public | setRenderOrder(the: Number) Sets the render order of this object. | |
public | setUpDirection(vector: *) | |
public | setVisible(val: Boolean) Set this object visibility |
Public Constructors
Public Members
public children: *[] source
public mobObject: * source
public nativeObject: * source
public recursiveChildren: *[] source
Public Methods
public addChild(child: Transform Mesh) source
Adds a child to this transform (argument must be a transform too)
Params:
Name | Type | Attribute | Description |
child | Transform Mesh |
public addChildren(child: Array) source
Adds a children array to this transform (argument must be a transform too)
Params:
Name | Type | Attribute | Description |
child | Array |
public getChild(index: Number): Object source
Gets one of all the children objects of this transform
Params:
Name | Type | Attribute | Description |
index | Number | Index of the child to get |
Return:
Object |
public getChildren(recursive: *): Array source
Gets an array containning all the children objects of this transform
Params:
Name | Type | Attribute | Description |
recursive | * |
Return:
Array |
public getDirections(): Object source
Get the 3 direction vectors of this transform
Return:
Object | object with all 3 Vector3 as {upVector: upVector, forwardVector: forwardVector,leftVector: leftVector}; |
public getLocalEulerAngles(): * source
Return:
* |
public getLocalPosition(): Vector3 source
Gets the local position of this transform
Return:
Vector3 | localPosition vector |
public getLocalPositionX(): Number source
Gets the local x position of this transform
Return:
Number | localPosition x |
public getLocalPositionY(): Number source
Gets the local x position of this transform
Return:
Number | localPosition y |
public getLocalPositionZ(): Number source
Gets the local z position of this transform
Return:
Number | localPosition z |
public getLocalQuaternion(): Quaternion source
Get the object rotation as a quarternion.
Return:
Quaternion | quarternion |
public getLocalRotation(): Vector3 source
Get the current local rotation of this transform
Return:
Vector3 | localRotation vector |
public getLocalRotationX(): Number source
Get the current x local rotation of this transform
Return:
Number | localRotation x value |
public getLocalRotationY(): Number source
Get the current y local rotation of this transform
Return:
Number | localRotation y value |
public getLocalRotationZ(): Number source
Get the current z local rotation of this transform
Return:
Number | localRotation z value |
public getNativeObject(): * source
Return:
* | the Three.js native object used in this class |
public getParent(): * source
Return:
* |
public getRecurseChildren(transform: *) source
Params:
Name | Type | Attribute | Description |
transform | * |
public getScreenCoordinates(context: Context, camera: Camera): Vector2 source
Return a Vector2 giving the screen coordinates of the object
Return:
Vector2 | the screen coordinates of the object |
public getVisible(): * source
Return:
* | the visibility of this object |
public getWorldMatrix(): * source
get the world matrix of the object
Return:
* | world matrix of the object |
public getWorldQuaternion(): * source
get the world quaternion of the object
Return:
* | world quaternion of the object |
public lookAt(vector: Vector) source
Geneates a transform to point at a certain coordinates, makes the object "look at" this point.
Params:
Name | Type | Attribute | Description |
vector | Vector |
public pick(cam: Camera, x: number, y: number): Object source
Perform a RayCast picking
Return:
Object | if picking success, gives an object as {point:{x,y,z} in world coordinates, uv:{u,v}, distance:dist}, null otherwise. |
public removeChild(child: Transform) source
Removes a child from the children chain
Params:
Name | Type | Attribute | Description |
child | Transform |
public setLocalEulerAngles(arg1: *, arg2: *, arg3: *) source
Params:
Name | Type | Attribute | Description |
arg1 | * | ||
arg2 | * | ||
arg3 | * |
public setLocalMatrix(m: *) source
Params:
Name | Type | Attribute | Description |
m | * |
public setLocalPosition(number|Vector3|Vector2: float | Vector3 | Vector2, Number: float, Number: float) source
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.
Params:
Name | Type | Attribute | Description |
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. |
public setLocalPositionX(arg: Number) source
Sets this transform's x position
Params:
Name | Type | Attribute | Description |
arg | Number |
public setLocalPositionY(arg: Number) source
Sets this transform's y position
Params:
Name | Type | Attribute | Description |
arg | Number |
public setLocalPositionZ(arg: Number) source
Sets this transform's z position
Params:
Name | Type | Attribute | Description |
arg | Number |
public setLocalQuaternion(quarternion: Quaternion) source
Set the object rotation with a quarternion {x,y,z,w}.
Params:
Name | Type | Attribute | Description |
quarternion | Quaternion | The quaternion to apply |
public setLocalRotation(number|Vector3|Vector2: float | Vector3 | Vector2, Number: float, Number: float) source
Set the euler angles rotation in degrees. Polymorphic : can take various agruments of various types. Possible arguments number is 1, 2 or 3.
Params:
Name | Type | Attribute | Description |
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. |
public setLocalRotationOrder(order: string) source
Defines the oreder of application for rotation axis. Default is 'XYZ', others are'YZX', 'ZXY', 'XZY', 'YXZ' and 'ZYX'
Params:
Name | Type | Attribute | Description |
order | string | one of 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ' and 'ZYX' |
public setLocalRotationX(arg: Number) source
Sets this transform's x rotation
Params:
Name | Type | Attribute | Description |
arg | Number |
public setLocalRotationY(arg: Number) source
Sets this transform's y rotation
Params:
Name | Type | Attribute | Description |
arg | Number |
public setLocalRotationZ(arg: Number) source
Sets this transform's z rotation
Params:
Name | Type | Attribute | Description |
arg | Number |
public setLocalScale(number|Vector3|Vector2: float | Vector3 | Vector2, Number: float, Number: float) source
Set the scale of the transform. Polymorphic : can take various agruments of various types. Possible arguments number is 1, 2 or 3.
Params:
Name | Type | Attribute | Description |
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. |
public setLocalScaleX(arg: Number) source
Sets this transform's x scale
Params:
Name | Type | Attribute | Description |
arg | Number |
public setLocalScaleY(arg: Number) source
Sets this transform's y scale
Params:
Name | Type | Attribute | Description |
arg | Number |
public setLocalScaleZ(arg: Number) source
Sets this transform's z scale
Params:
Name | Type | Attribute | Description |
arg | Number |
public setRenderOrder(the: Number) source
Sets the render order of this object. The sortObjects of the renderer should be true for this property to have any effect.
Params:
Name | Type | Attribute | Description |
the | Number | render order index |
public setUpDirection(vector: *) source
Params:
Name | Type | Attribute | Description |
vector | * |