class TransformNode extends Node
Name | Type | Description | |
---|---|---|---|
name | string | ||
optional | scene | Nullable<Scene> | |
optional | isPure | boolean |
An event triggered after the world matrix is updated
@type {BABYLON.Observable}
Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z.
If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
Default : (0.0, 0.0, 0.0)
Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
Default : (1.0, 1.0, 1.0)
Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
Default : (1.0, 1.0, 1.0)
Rotation Quaternion property : this a Quaternion object depicting the mesh rotation by using a unit quaternion.
It's null by default.
If set, only the rotationQuaternion is then used to compute the mesh rotation and its property `.rotation\ is then ignored and set to (0.0, 0.0, 0.0)
Returns directly the latest state of the mesh World matrix.
A Matrix is returned.
Returns the current mesh absolute position.
Retuns a Vector3.
True if the World matrix has been frozen.
Returns a boolean.
Returns the latest update of the World matrix
Returns a Matrix.
Copies the paramater passed Matrix into the mesh Pose matrix.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
matrix | Matrix |
Returns the mesh Pose matrix.
Returned object : Matrix
Name | Type | Description | |
---|---|---|---|
property | string |
Sets a new pivot matrix to the mesh.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
matrix | Matrix | ||
optional | postMultiplyPivotMatrix | boolean |
Returns the mesh pivot matrix.
Default : Identity.
A Matrix is returned.
Prevents the World matrix to be computed any longer.
Returns the AbstractMesh.
Allows back the World matrix computation.
Returns the AbstractMesh.
Retuns the mesh absolute position in the World.
Returns a Vector3.
Sets the mesh absolute position in the World from a Vector3 or an Array(3).
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
absolutePosition | Vector3 |
Sets the mesh position in its local space.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
vector3 | Vector3 |
Returns the mesh position in the local space from the current World matrix values.
Returns a new Vector3.
Translates the mesh along the passed Vector3 in its local space.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
vector3 | Vector3 |
Orients a mesh towards a target point. Mesh must be drawn facing user.
@returns the TransformNode.
Name | Type | Description | |
---|---|---|---|
targetPoint | Vector3 | the position (must be in same space as current mesh) to look at | |
optional | yawCor | number | optional yaw (y-axis) correction in radians |
optional | pitchCor | number | optional pitch (x-axis) correction in radians |
optional | rollCor | number | optional roll (z-axis) correction in radians |
Returns a new Vector3 what is the localAxis, expressed in the mesh local space, rotated like the mesh.
This Vector3 is expressed in the World space.
Name | Type | Description | |
---|---|---|---|
localAxis | Vector3 |
Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh.
localAxis is expressed in the mesh local space.
result is computed in the Wordl space from the mesh World matrix.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
localAxis | Vector3 | ||
result | Vector3 |
Name | Type | Description | |
---|---|---|---|
point | Vector3 | ||
optional | space | Space |
Returns a new Vector3 set with the mesh pivot point coordinates in the local space.
Sets the passed Vector3 "result" with the coordinates of the mesh pivot point in the local space.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
result | Vector3 |
Returns a new Vector3 set with the mesh pivot point World coordinates.
Sets the Vector3 "result" coordinates with the mesh pivot point World coordinates.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
result | Vector3 |
Defines the passed node as the parent of the current node.
The node will remain exactly where it is and its position / rotation will be updated accordingly
Returns the TransformNode.
Name | Type | Description | |
---|---|---|---|
node | Nullable<Node> |
Attach the current TransformNode to another TransformNode associated with a bone
Name | Type | Description | |
---|---|---|---|
bone | Bone | Bone affecting the TransformNode | |
affectedTransformNode | TransformNode | TransformNode associated with the bone |
Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.
space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
Note that the property rotationQuaternion
is then automatically updated and the property rotation
is set to (0,0,0) and no longer used.
The passed axis is also normalized.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
axis | Vector3 | ||
amount | number | ||
optional | space | Space |
Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.
Note that the property rotationQuaternion
is then automatically updated and the property rotation
is set to (0,0,0) and no longer used.
The passed axis is also normalized.
Returns the AbstractMesh.
Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm
Name | Type | Description | |
---|---|---|---|
point | Vector3 | ||
axis | Vector3 | ||
amount | number |
Translates the mesh along the axis vector for the passed distance in the given space.
space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
axis | Vector3 | ||
distance | number | ||
optional | space | Space |
Adds a rotation step to the mesh current rotation.
x, y, z are Euler angles expressed in radians.
This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.
This means this rotation is made in the mesh local space only.
It's useful to set a custom rotation order different from the BJS standard one YXZ.
Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.
mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);
Note that addRotation()
accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.
Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number |
Computes the mesh World matrix and returns it.
If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values.
If the parameter force
is let to false
(default), the current cached World matrix is returned.
If the parameter force
is set to true
, the actual computation is done.
Returns the mesh World Matrix.
Name | Type | Description | |
---|---|---|---|
optional | force | boolean |
If you'd like to be called back after the mesh position, rotation or scaling has been updated.
* Returns the [TransformNode](/classes/3.1/TransformNode).
Name | Type | Description | |||
---|---|---|---|---|---|
func | mesh | TransformNode |
| : callback function to add
Removes a registered callback function.
Returns the TransformNode.
Name | Type | Description | |||
---|---|---|---|---|---|
func | mesh | TransformNode |
|
Clone the current transform node
Returns the new transform node
Name | Type | Description | |
---|---|---|---|
name | string | Name of the new clone | |
newParent | Node | New parent for the clone | |
optional | doNotCloneChildren | boolean | Do not clone children hierarchy |
Name | Type | Description | |
---|---|---|---|
optional | currentSerializationObject | any |
Returns a new TransformNode object parsed from the source provided.
The parameter parsedMesh
is the source.
The parameter rootUrl
is a string, it's the root URL to prefix the delayLoadingFile
property with
Name | Type | Description | |
---|---|---|---|
parsedTransformNode | any | ||
scene | Scene | ||
rootUrl | string |
Disposes the TransformNode.
By default, all the children are also disposed unless the parameter doNotRecurse
is set to true
.
Returns nothing.
Name | Type | Description | |
---|---|---|---|
optional | doNotRecurse | boolean |