@babylonjs/core 6.12.2 → 6.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animationGroup.d.ts +12 -1
- package/Animations/animationGroup.js +22 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Audio/sound.d.ts +1 -0
- package/Audio/sound.js +35 -8
- package/Audio/sound.js.map +1 -1
- package/Bones/bone.js +2 -2
- package/Bones/bone.js.map +1 -1
- package/Cameras/freeCamera.js +4 -4
- package/Cameras/freeCamera.js.map +1 -1
- package/Cameras/targetCamera.js +1 -1
- package/Cameras/targetCamera.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +5 -1
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.d.ts +267 -0
- package/Materials/meshDebugPluginMaterial.js +510 -0
- package/Materials/meshDebugPluginMaterial.js.map +1 -0
- package/Misc/dumpTools.js +12 -3
- package/Misc/dumpTools.js.map +1 -1
- package/Particles/particleSystem.js +4 -1
- package/Particles/particleSystem.js.map +1 -1
- package/package.json +1 -1
package/Bones/bone.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bone.js","sourceRoot":"","sources":["../../../../dev/core/src/Bones/bone.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAK3C;;;GAGG;AACH,MAAM,OAAO,IAAK,SAAQ,IAAI;IA+C1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,IAAI,KAAK,IAAI,EAAE,EAAE;YACb,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;SAChC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;QAEd,OAAO,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACI,oBAAoB;QACvB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC9C,CAAC;;AA7rCc,aAAQ,GAAc,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,AAApD,CAAqD;AAC7D,aAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,AAAxB,CAAyB;AACjC,aAAQ,GAAa,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,AAAtD,CAAuD","sourcesContent":["import type { Skeleton } from \"./skeleton\";\r\nimport { Vector3, Quaternion, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport { ArrayTools } from \"../Misc/arrayTools\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport { Node } from \"../node\";\r\nimport { Space } from \"../Maths/math.axis\";\r\n\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { AnimationPropertiesOverride } from \"../Animations/animationPropertiesOverride\";\r\n\r\n/**\r\n * Class used to store bone information\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\r\n */\r\nexport class Bone extends Node {\r\n private static _TmpVecs: Vector3[] = ArrayTools.BuildArray(2, Vector3.Zero);\r\n private static _TmpQuat = Quaternion.Identity();\r\n private static _TmpMats: Matrix[] = ArrayTools.BuildArray(5, Matrix.Identity);\r\n\r\n /**\r\n * Gets the list of child bones\r\n */\r\n public children = new Array<Bone>();\r\n\r\n /** Gets the animations associated with this bone */\r\n public animations = new Array<Animation>();\r\n\r\n /**\r\n * Gets or sets bone length\r\n */\r\n public length: number;\r\n\r\n /**\r\n * @internal Internal only\r\n * Set this value to map this bone to a different index in the transform matrices\r\n * Set this value to -1 to exclude the bone from the transform matrices\r\n */\r\n public _index: Nullable<number> = null;\r\n\r\n private _skeleton: Skeleton;\r\n private _localMatrix: Matrix; // transformation of the bone, in local space\r\n private _absoluteMatrix: Matrix; // transformation of the bone, in world space (relative to the skeleton root)\r\n private _bindMatrix: Matrix; // the bind matrix, in local space\r\n private _absoluteBindMatrix: Matrix; // the bind matrix, in world space (relative to the skeleton root)\r\n private _absoluteInverseBindMatrix: Matrix; // the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n private _finalMatrix: Matrix; // the final matrix used to transform vertices of the mesh according to the bone, in world space (relative to the skeleton root). It is the multiplication of _absoluteInverseBindMatrix with _absoluteMatrix.\r\n private _restMatrix: Matrix; // a matrix for the exclusive use of the end user (not used internally by the framework), in local space\r\n private _scalingDeterminant = 1;\r\n\r\n private _localScaling: Vector3;\r\n private _localRotation: Quaternion;\r\n private _localPosition: Vector3;\r\n private _needToDecompose = true;\r\n private _needToCompose = false;\r\n\r\n /** @internal */\r\n public _linkedTransformNode: Nullable<TransformNode> = null;\r\n\r\n /** @internal */\r\n public _waitingTransformNodeId: Nullable<string> = null;\r\n\r\n /** @internal */\r\n get _matrix(): Matrix {\r\n this._compose();\r\n return this._localMatrix;\r\n }\r\n\r\n /** @internal */\r\n set _matrix(value: Matrix) {\r\n this._needToCompose = false; // in case there was a pending compose\r\n\r\n // skip if the matrices are the same\r\n if (value.updateFlag === this._localMatrix.updateFlag) {\r\n return;\r\n }\r\n\r\n this._localMatrix.copyFrom(value);\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n /**\r\n * Create a new bone\r\n * @param name defines the bone name\r\n * @param skeleton defines the parent skeleton\r\n * @param parentBone defines the parent (can be null if the bone is the root)\r\n * @param localMatrix defines the local matrix (default: identity)\r\n * @param restMatrix defines the rest matrix (default: localMatrix)\r\n * @param bindMatrix defines the bind matrix (default: localMatrix)\r\n * @param index defines index of the bone in the hierarchy (default: null)\r\n */\r\n constructor(\r\n /**\r\n * defines the bone name\r\n */\r\n public name: string,\r\n skeleton: Skeleton,\r\n parentBone: Nullable<Bone> = null,\r\n localMatrix: Nullable<Matrix> = null,\r\n restMatrix: Nullable<Matrix> = null,\r\n bindMatrix: Nullable<Matrix> = null,\r\n index: Nullable<number> = null\r\n ) {\r\n super(name, skeleton.getScene());\r\n this._skeleton = skeleton;\r\n this._localMatrix = localMatrix?.clone() ?? Matrix.Identity();\r\n this._restMatrix = restMatrix ?? this._localMatrix.clone();\r\n this._bindMatrix = bindMatrix ?? this._localMatrix.clone();\r\n this._index = index;\r\n\r\n this._absoluteMatrix = new Matrix();\r\n this._absoluteBindMatrix = new Matrix();\r\n this._absoluteInverseBindMatrix = new Matrix();\r\n this._finalMatrix = new Matrix();\r\n\r\n skeleton.bones.push(this);\r\n\r\n this.setParent(parentBone, false);\r\n\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n /**\r\n * Gets the current object class name.\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"Bone\";\r\n }\r\n\r\n // Members\r\n\r\n /**\r\n * Gets the parent skeleton\r\n * @returns a skeleton\r\n */\r\n public getSkeleton(): Skeleton {\r\n return this._skeleton;\r\n }\r\n\r\n public get parent(): Bone {\r\n return this._parentNode as Bone;\r\n }\r\n\r\n /**\r\n * Gets parent bone\r\n * @returns a bone or null if the bone is the root of the bone hierarchy\r\n */\r\n public getParent(): Nullable<Bone> {\r\n return this.parent;\r\n }\r\n\r\n /**\r\n * Returns an array containing the children of the bone\r\n * @returns an array containing the children of the bone (can be empty if the bone has no children)\r\n */\r\n public getChildren(): Array<Bone> {\r\n return this.children;\r\n }\r\n\r\n /**\r\n * Gets the node index in matrix array generated for rendering\r\n * @returns the node index\r\n */\r\n public getIndex(): number {\r\n return this._index === null ? this.getSkeleton().bones.indexOf(this) : this._index;\r\n }\r\n\r\n public set parent(newParent: Nullable<Bone>) {\r\n this.setParent(newParent);\r\n }\r\n\r\n /**\r\n * Sets the parent bone\r\n * @param parent defines the parent (can be null if the bone is the root)\r\n * @param updateAbsoluteBindMatrices defines if the absolute bind and absolute inverse bind matrices must be updated\r\n */\r\n public setParent(parent: Nullable<Bone>, updateAbsoluteBindMatrices: boolean = true): void {\r\n if (this.parent === parent) {\r\n return;\r\n }\r\n\r\n if (this.parent) {\r\n const index = this.parent.children.indexOf(this);\r\n if (index !== -1) {\r\n this.parent.children.splice(index, 1);\r\n }\r\n }\r\n\r\n this._parentNode = parent;\r\n\r\n if (this.parent) {\r\n this.parent.children.push(this);\r\n }\r\n\r\n if (updateAbsoluteBindMatrices) {\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n this.markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the local matrix\r\n * @returns the local matrix\r\n */\r\n public getLocalMatrix(): Matrix {\r\n this._compose();\r\n return this._localMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bind matrix\r\n * @returns the bind matrix\r\n */\r\n public getBindMatrix(): Matrix {\r\n return this._bindMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bind matrix.\r\n * @returns the bind matrix\r\n * @deprecated Please use getBindMatrix instead\r\n */\r\n public getBaseMatrix(): Matrix {\r\n return this.getBindMatrix();\r\n }\r\n\r\n /**\r\n * Gets the rest matrix\r\n * @returns the rest matrix\r\n */\r\n public getRestMatrix(): Matrix {\r\n return this._restMatrix;\r\n }\r\n\r\n /**\r\n * Gets the rest matrix\r\n * @returns the rest matrix\r\n * @deprecated Please use getRestMatrix instead\r\n */\r\n public getRestPose(): Matrix {\r\n return this.getRestMatrix();\r\n }\r\n\r\n /**\r\n * Sets the rest matrix\r\n * @param matrix the local-space rest matrix to set for this bone\r\n */\r\n public setRestMatrix(matrix: Matrix): void {\r\n this._restMatrix.copyFrom(matrix);\r\n }\r\n\r\n /**\r\n * Sets the rest matrix\r\n * @param matrix the local-space rest to set for this bone\r\n * @deprecated Please use setRestMatrix instead\r\n */\r\n public setRestPose(matrix: Matrix): void {\r\n this.setRestMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Gets the bind matrix\r\n * @returns the bind matrix\r\n * @deprecated Please use getBindMatrix instead\r\n */\r\n public getBindPose(): Matrix {\r\n return this.getBindMatrix();\r\n }\r\n\r\n /**\r\n * Sets the bind matrix\r\n * This will trigger a recomputation of the absolute bind and absolute inverse bind matrices for this bone and its children\r\n * Note that the local matrix will also be set with the matrix passed in parameter!\r\n * @param matrix the local-space bind matrix to set for this bone\r\n */\r\n public setBindMatrix(matrix: Matrix): void {\r\n this.updateMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Sets the bind matrix\r\n * @param matrix the local-space bind to set for this bone\r\n * @deprecated Please use setBindMatrix instead\r\n */\r\n public setBindPose(matrix: Matrix): void {\r\n this.setBindMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Gets the matrix used to store the final world transformation of the bone (ie. the matrix sent to shaders)\r\n */\r\n public getFinalMatrix(): Matrix {\r\n return this._finalMatrix;\r\n }\r\n\r\n /**\r\n * Gets the matrix used to store the final world transformation of the bone (ie. the matrix sent to shaders)\r\n * @deprecated Please use getFinalMatrix instead\r\n */\r\n public getWorldMatrix(): Matrix {\r\n return this.getFinalMatrix();\r\n }\r\n\r\n /**\r\n * Sets the local matrix to the rest matrix\r\n */\r\n public returnToRest(): void {\r\n if (this._linkedTransformNode) {\r\n const localScaling = TmpVectors.Vector3[0];\r\n const localRotation = TmpVectors.Quaternion[0];\r\n const localPosition = TmpVectors.Vector3[1];\r\n\r\n this.getRestMatrix().decompose(localScaling, localRotation, localPosition);\r\n\r\n this._linkedTransformNode.position.copyFrom(localPosition);\r\n this._linkedTransformNode.rotationQuaternion = this._linkedTransformNode.rotationQuaternion ?? Quaternion.Identity();\r\n this._linkedTransformNode.rotationQuaternion.copyFrom(localRotation);\r\n this._linkedTransformNode.scaling.copyFrom(localScaling);\r\n } else {\r\n this._matrix = this._restMatrix;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n * @returns the inverse bind matrix, in world space\r\n */\r\n public getAbsoluteInverseBindMatrix(): Matrix {\r\n return this._absoluteInverseBindMatrix;\r\n }\r\n\r\n /**\r\n * Gets the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n * @returns the inverse bind matrix, in world space\r\n * @deprecated Please use getAbsoluteInverseBindMatrix instead\r\n */\r\n public getInvertedAbsoluteTransform(): Matrix {\r\n return this.getAbsoluteInverseBindMatrix();\r\n }\r\n\r\n /**\r\n * Gets the bone matrix, in world space (relative to the skeleton root)\r\n * @returns the bone matrix, in world space\r\n */\r\n public getAbsoluteMatrix(): Matrix {\r\n return this._absoluteMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bone matrix, in world space (relative to the skeleton root)\r\n * @returns the bone matrix, in world space\r\n * @deprecated Please use getAbsoluteMatrix instead\r\n */\r\n public getAbsoluteTransform(): Matrix {\r\n return this._absoluteMatrix;\r\n }\r\n\r\n /**\r\n * Links with the given transform node.\r\n * The local matrix of this bone is overwritten by the transform of the node every frame.\r\n * @param transformNode defines the transform node to link to\r\n */\r\n public linkTransformNode(transformNode: Nullable<TransformNode>): void {\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode--;\r\n }\r\n\r\n this._linkedTransformNode = transformNode;\r\n\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode++;\r\n }\r\n }\r\n\r\n // Properties (matches TransformNode properties)\r\n\r\n /**\r\n * Gets the node used to drive the bone's transformation\r\n * @returns a transform node or null\r\n */\r\n public getTransformNode() {\r\n return this._linkedTransformNode;\r\n }\r\n\r\n /** Gets or sets current position (in local space) */\r\n public get position(): Vector3 {\r\n this._decompose();\r\n return this._localPosition;\r\n }\r\n\r\n public set position(newPosition: Vector3) {\r\n this._decompose();\r\n this._localPosition.copyFrom(newPosition);\r\n\r\n this._markAsDirtyAndCompose();\r\n }\r\n\r\n /** Gets or sets current rotation (in local space) */\r\n public get rotation(): Vector3 {\r\n return this.getRotation();\r\n }\r\n\r\n public set rotation(newRotation: Vector3) {\r\n this.setRotation(newRotation);\r\n }\r\n\r\n /** Gets or sets current rotation quaternion (in local space) */\r\n public get rotationQuaternion() {\r\n this._decompose();\r\n return this._localRotation;\r\n }\r\n\r\n public set rotationQuaternion(newRotation: Quaternion) {\r\n this.setRotationQuaternion(newRotation);\r\n }\r\n\r\n /** Gets or sets current scaling (in local space) */\r\n public get scaling(): Vector3 {\r\n return this.getScale();\r\n }\r\n\r\n public set scaling(newScaling: Vector3) {\r\n this.setScale(newScaling);\r\n }\r\n\r\n /**\r\n * Gets the animation properties override\r\n */\r\n public get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride> {\r\n return this._skeleton.animationPropertiesOverride;\r\n }\r\n\r\n // Methods\r\n private _decompose() {\r\n if (!this._needToDecompose) {\r\n return;\r\n }\r\n\r\n this._needToDecompose = false;\r\n\r\n if (!this._localScaling) {\r\n this._localScaling = Vector3.Zero();\r\n this._localRotation = Quaternion.Zero();\r\n this._localPosition = Vector3.Zero();\r\n }\r\n this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition);\r\n }\r\n\r\n private _compose() {\r\n if (!this._needToCompose) {\r\n return;\r\n }\r\n\r\n if (!this._localScaling) {\r\n this._needToCompose = false;\r\n return;\r\n }\r\n\r\n this._needToCompose = false;\r\n Matrix.ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix);\r\n }\r\n\r\n /**\r\n * Update the bind (and optionally the local) matrix\r\n * @param bindMatrix defines the new matrix to set to the bind/local matrix, in local space\r\n * @param updateAbsoluteBindMatrices defines if the absolute bind and absolute inverse bind matrices must be recomputed (default: true)\r\n * @param updateLocalMatrix defines if the local matrix should also be updated with the matrix passed in parameter (default: true)\r\n */\r\n public updateMatrix(bindMatrix: Matrix, updateAbsoluteBindMatrices = true, updateLocalMatrix = true): void {\r\n this._bindMatrix.copyFrom(bindMatrix);\r\n\r\n if (updateAbsoluteBindMatrices) {\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n if (updateLocalMatrix) {\r\n this._matrix = bindMatrix;\r\n } else {\r\n this.markAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updateAbsoluteBindMatrices(bindMatrix?: Matrix, updateChildren = true): void {\r\n if (!bindMatrix) {\r\n bindMatrix = this._bindMatrix;\r\n }\r\n\r\n if (this.parent) {\r\n bindMatrix.multiplyToRef(this.parent._absoluteBindMatrix, this._absoluteBindMatrix);\r\n } else {\r\n this._absoluteBindMatrix.copyFrom(bindMatrix);\r\n }\r\n\r\n this._absoluteBindMatrix.invertToRef(this._absoluteInverseBindMatrix);\r\n\r\n if (updateChildren) {\r\n for (let index = 0; index < this.children.length; index++) {\r\n this.children[index]._updateAbsoluteBindMatrices();\r\n }\r\n }\r\n\r\n this._scalingDeterminant = this._absoluteBindMatrix.determinant() < 0 ? -1 : 1;\r\n }\r\n\r\n /**\r\n * Flag the bone as dirty (Forcing it to update everything)\r\n * @returns this bone\r\n */\r\n public markAsDirty(): Bone {\r\n this._currentRenderId++;\r\n this._childUpdateId++;\r\n this._skeleton._markAsDirty();\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n public _markAsDirtyAndCompose() {\r\n this.markAsDirty();\r\n this._needToCompose = true;\r\n }\r\n\r\n private _markAsDirtyAndDecompose() {\r\n this.markAsDirty();\r\n this._needToDecompose = true;\r\n }\r\n\r\n private _updatePosition(vec: Vector3, space = Space.LOCAL, tNode?: TransformNode, translationMode = true): void {\r\n const lm = this.getLocalMatrix();\r\n\r\n if (space == Space.LOCAL) {\r\n if (translationMode) {\r\n lm.addAtIndex(12, vec.x);\r\n lm.addAtIndex(13, vec.y);\r\n lm.addAtIndex(14, vec.z);\r\n } else {\r\n lm.setTranslationFromFloats(vec.x, vec.y, vec.z);\r\n }\r\n } else {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n const tvec = Bone._TmpVecs[0];\r\n\r\n if (this.parent) {\r\n if (tNode && wm) {\r\n tmat.copyFrom(this.parent.getAbsoluteMatrix());\r\n tmat.multiplyToRef(wm, tmat);\r\n } else {\r\n tmat.copyFrom(this.parent.getAbsoluteMatrix());\r\n }\r\n } else {\r\n Matrix.IdentityToRef(tmat);\r\n }\r\n\r\n if (translationMode) {\r\n tmat.setTranslationFromFloats(0, 0, 0);\r\n }\r\n tmat.invert();\r\n Vector3.TransformCoordinatesToRef(vec, tmat, tvec);\r\n\r\n if (translationMode) {\r\n lm.addAtIndex(12, tvec.x);\r\n lm.addAtIndex(13, tvec.y);\r\n lm.addAtIndex(14, tvec.z);\r\n } else {\r\n lm.setTranslationFromFloats(tvec.x, tvec.y, tvec.z);\r\n }\r\n }\r\n\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n /**\r\n * Translate the bone in local or world space\r\n * @param vec The amount to translate the bone\r\n * @param space The space that the translation is in (default: Space.LOCAL)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public translate(vec: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this._updatePosition(vec, space, tNode, true);\r\n }\r\n\r\n /**\r\n * Set the position of the bone in local or world space\r\n * @param position The position to set the bone\r\n * @param space The space that the position is in (default: Space.LOCAL)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setPosition(position: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this._updatePosition(position, space, tNode, false);\r\n }\r\n\r\n /**\r\n * Set the absolute position of the bone (world space)\r\n * @param position The position to set the bone\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setAbsolutePosition(position: Vector3, tNode?: TransformNode) {\r\n this.setPosition(position, Space.WORLD, tNode);\r\n }\r\n\r\n /**\r\n * Scale the bone on the x, y and z axes (in local space)\r\n * @param x The amount to scale the bone on the x axis\r\n * @param y The amount to scale the bone on the y axis\r\n * @param z The amount to scale the bone on the z axis\r\n * @param scaleChildren sets this to true if children of the bone should be scaled as well (false by default)\r\n */\r\n public scale(x: number, y: number, z: number, scaleChildren = false): void {\r\n const locMat = this.getLocalMatrix();\r\n\r\n // Apply new scaling on top of current local matrix\r\n const scaleMat = Bone._TmpMats[0];\r\n Matrix.ScalingToRef(x, y, z, scaleMat);\r\n scaleMat.multiplyToRef(locMat, locMat);\r\n\r\n // Invert scaling matrix and apply the inverse to all children\r\n scaleMat.invert();\r\n\r\n for (const child of this.children) {\r\n const cm = child.getLocalMatrix();\r\n cm.multiplyToRef(scaleMat, cm);\r\n cm.multiplyAtIndex(12, x);\r\n cm.multiplyAtIndex(13, y);\r\n cm.multiplyAtIndex(14, z);\r\n\r\n child._markAsDirtyAndDecompose();\r\n }\r\n\r\n this._markAsDirtyAndDecompose();\r\n\r\n if (scaleChildren) {\r\n for (const child of this.children) {\r\n child.scale(x, y, z, scaleChildren);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the bone scaling in local space\r\n * @param scale defines the scaling vector\r\n */\r\n public setScale(scale: Vector3): void {\r\n this._decompose();\r\n this._localScaling.copyFrom(scale);\r\n this._markAsDirtyAndCompose();\r\n }\r\n\r\n /**\r\n * Gets the current scaling in local space\r\n * @returns the current scaling vector\r\n */\r\n public getScale(): Vector3 {\r\n this._decompose();\r\n return this._localScaling;\r\n }\r\n\r\n /**\r\n * Gets the current scaling in local space and stores it in a target vector\r\n * @param result defines the target vector\r\n */\r\n public getScaleToRef(result: Vector3) {\r\n this._decompose();\r\n result.copyFrom(this._localScaling);\r\n }\r\n\r\n /**\r\n * Set the yaw, pitch, and roll of the bone in local or world space\r\n * @param yaw The rotation of the bone on the y axis\r\n * @param pitch The rotation of the bone on the x axis\r\n * @param roll The rotation of the bone on the z axis\r\n * @param space The space that the axes of rotation are in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setYawPitchRoll(yaw: number, pitch: number, roll: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, quat);\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Add a rotation to the bone on an axis in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param amount The amount to rotate the bone\r\n * @param space The space that the axis is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public rotate(axis: Vector3, amount: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n const rmat = Bone._TmpMats[0];\r\n rmat.setTranslationFromFloats(0, 0, 0);\r\n Matrix.RotationAxisToRef(axis, amount, rmat);\r\n this._rotateWithMatrix(rmat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the rotation of the bone to a particular axis angle in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param angle The angle that the bone should be rotated to\r\n * @param space The space that the axis is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setAxisAngle(axis: Vector3, angle: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.RotationAxisToRef(axis, angle, quat);\r\n\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.RotationAxisToRef(axis, angle, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the euler rotation of the bone in local or world space\r\n * @param rotation The euler rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotation(rotation: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the quaternion rotation of the bone in local or world space\r\n * @param quat The quaternion rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotationQuaternion(quat: Quaternion, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n this._decompose();\r\n this._localRotation.copyFrom(quat);\r\n\r\n this._markAsDirtyAndCompose();\r\n\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.FromQuaternionToRef(quat, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the rotation matrix of the bone in local or world space\r\n * @param rotMat The rotation matrix that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotationMatrix(rotMat: Matrix, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.FromRotationMatrixToRef(rotMat, quat);\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat2 = Bone._TmpMats[1];\r\n rotMat2.copyFrom(rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat2);\r\n\r\n this._rotateWithMatrix(rotMat2, space, tNode);\r\n }\r\n\r\n private _rotateWithMatrix(rmat: Matrix, space = Space.LOCAL, tNode?: TransformNode): void {\r\n const lmat = this.getLocalMatrix();\r\n const lx = lmat.m[12];\r\n const ly = lmat.m[13];\r\n const lz = lmat.m[14];\r\n const parent = this.getParent();\r\n const parentScale = Bone._TmpMats[3];\r\n const parentScaleInv = Bone._TmpMats[4];\r\n\r\n if (parent && space == Space.WORLD) {\r\n if (tNode) {\r\n parentScale.copyFrom(tNode.getWorldMatrix());\r\n parent.getAbsoluteMatrix().multiplyToRef(parentScale, parentScale);\r\n } else {\r\n parentScale.copyFrom(parent.getAbsoluteMatrix());\r\n }\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n } else {\r\n if (space == Space.WORLD && tNode) {\r\n parentScale.copyFrom(tNode.getWorldMatrix());\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n } else {\r\n lmat.multiplyToRef(rmat, lmat);\r\n }\r\n }\r\n\r\n lmat.setTranslationFromFloats(lx, ly, lz);\r\n\r\n this.computeAbsoluteMatrices();\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n private _getAbsoluteInverseMatrixUnscaledToRef(rotMatInv: Matrix, tNode?: TransformNode): boolean {\r\n const scaleMatrix = Bone._TmpMats[2];\r\n rotMatInv.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode) {\r\n rotMatInv.multiplyToRef(tNode.getWorldMatrix(), rotMatInv);\r\n Matrix.ScalingToRef(tNode.scaling.x, tNode.scaling.y, tNode.scaling.z, scaleMatrix);\r\n } else {\r\n Matrix.IdentityToRef(scaleMatrix);\r\n }\r\n\r\n rotMatInv.invert();\r\n if (isNaN(rotMatInv.m[0])) {\r\n // Matrix failed to invert.\r\n // This can happen if scale is zero for example.\r\n return false;\r\n }\r\n\r\n scaleMatrix.multiplyAtIndex(0, this._scalingDeterminant);\r\n rotMatInv.multiplyToRef(scaleMatrix, rotMatInv);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Get the position of the bone in local or world space\r\n * @param space The space that the returned position is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The position of the bone\r\n */\r\n public getPosition(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const pos = Vector3.Zero();\r\n\r\n this.getPositionToRef(space, tNode, pos);\r\n\r\n return pos;\r\n }\r\n\r\n /**\r\n * Copy the position of the bone to a vector3 in local or world space\r\n * @param space The space that the returned position is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 to copy the position to\r\n */\r\n public getPositionToRef(space = Space.LOCAL, tNode: Nullable<TransformNode>, result: Vector3): void {\r\n if (space == Space.LOCAL) {\r\n const lm = this.getLocalMatrix();\r\n\r\n result.x = lm.m[12];\r\n result.y = lm.m[13];\r\n result.z = lm.m[14];\r\n } else {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n let tmat = Bone._TmpMats[0];\r\n\r\n if (tNode && wm) {\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n tmat.multiplyToRef(wm, tmat);\r\n } else {\r\n tmat = this.getAbsoluteMatrix();\r\n }\r\n\r\n result.x = tmat.m[12];\r\n result.y = tmat.m[13];\r\n result.z = tmat.m[14];\r\n }\r\n }\r\n\r\n /**\r\n * Get the absolute position of the bone (world space)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The absolute position of the bone\r\n */\r\n public getAbsolutePosition(tNode: Nullable<TransformNode> = null): Vector3 {\r\n const pos = Vector3.Zero();\r\n\r\n this.getPositionToRef(Space.WORLD, tNode, pos);\r\n\r\n return pos;\r\n }\r\n\r\n /**\r\n * Copy the absolute position of the bone (world space) to the result param\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 to copy the absolute position to\r\n */\r\n public getAbsolutePositionToRef(tNode: TransformNode, result: Vector3) {\r\n this.getPositionToRef(Space.WORLD, tNode, result);\r\n }\r\n\r\n /**\r\n * Compute the absolute matrices of this bone and its children\r\n */\r\n public computeAbsoluteMatrices(): void {\r\n this._compose();\r\n\r\n if (this.parent) {\r\n this._localMatrix.multiplyToRef(this.parent._absoluteMatrix, this._absoluteMatrix);\r\n } else {\r\n this._absoluteMatrix.copyFrom(this._localMatrix);\r\n\r\n const poseMatrix = this._skeleton.getPoseMatrix();\r\n\r\n if (poseMatrix) {\r\n this._absoluteMatrix.multiplyToRef(poseMatrix, this._absoluteMatrix);\r\n }\r\n }\r\n\r\n const children = this.children;\r\n const len = children.length;\r\n\r\n for (let i = 0; i < len; i++) {\r\n children[i].computeAbsoluteMatrices();\r\n }\r\n }\r\n\r\n /**\r\n * Compute the absolute matrices of this bone and its children\r\n * @deprecated Please use computeAbsoluteMatrices instead\r\n */\r\n public computeAbsoluteTransforms(): void {\r\n this.computeAbsoluteMatrices();\r\n }\r\n\r\n /**\r\n * Get the world direction from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The world direction\r\n */\r\n public getDirection(localAxis: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getDirectionToRef(localAxis, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the world direction to a vector3 from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the world direction will be copied to\r\n */\r\n public getDirectionToRef(localAxis: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const mat = Bone._TmpMats[0];\r\n\r\n mat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n mat.multiplyToRef(wm, mat);\r\n }\r\n\r\n Vector3.TransformNormalToRef(localAxis, mat, result);\r\n\r\n result.normalize();\r\n }\r\n\r\n /**\r\n * Get the euler rotation of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The euler rotation\r\n */\r\n public getRotation(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getRotationToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the rotation should be copied to\r\n */\r\n public getRotationToRef(space = Space.LOCAL, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n const quat = Bone._TmpQuat;\r\n\r\n this.getRotationQuaternionToRef(space, tNode, quat);\r\n\r\n quat.toEulerAnglesToRef(result);\r\n }\r\n\r\n /**\r\n * Get the quaternion rotation of the bone in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The quaternion rotation\r\n */\r\n public getRotationQuaternion(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Quaternion {\r\n const result = Quaternion.Identity();\r\n\r\n this.getRotationQuaternionToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n public getRotationQuaternionToRef(space = Space.LOCAL, tNode: Nullable<TransformNode> = null, result: Quaternion): void {\r\n if (space == Space.LOCAL) {\r\n this._decompose();\r\n result.copyFrom(this._localRotation);\r\n } else {\r\n const mat = Bone._TmpMats[0];\r\n const amat = this.getAbsoluteMatrix();\r\n\r\n if (tNode) {\r\n amat.multiplyToRef(tNode.getWorldMatrix(), mat);\r\n } else {\r\n mat.copyFrom(amat);\r\n }\r\n\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n\r\n mat.decompose(undefined, result, undefined);\r\n }\r\n }\r\n\r\n /**\r\n * Get the rotation matrix of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The rotation matrix\r\n */\r\n public getRotationMatrix(space = Space.LOCAL, tNode: TransformNode): Matrix {\r\n const result = Matrix.Identity();\r\n\r\n this.getRotationMatrixToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n public getRotationMatrixToRef(space = Space.LOCAL, tNode: TransformNode, result: Matrix): void {\r\n if (space == Space.LOCAL) {\r\n this.getLocalMatrix().getRotationMatrixToRef(result);\r\n } else {\r\n const mat = Bone._TmpMats[0];\r\n const amat = this.getAbsoluteMatrix();\r\n\r\n if (tNode) {\r\n amat.multiplyToRef(tNode.getWorldMatrix(), mat);\r\n } else {\r\n mat.copyFrom(amat);\r\n }\r\n\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n\r\n mat.getRotationMatrixToRef(result);\r\n }\r\n }\r\n\r\n /**\r\n * Get the world position of a point that is in the local space of the bone\r\n * @param position The local position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The world position\r\n */\r\n public getAbsolutePositionFromLocal(position: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getAbsolutePositionFromLocalToRef(position, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get the world position of a point that is in the local space of the bone and copy it to the result param\r\n * @param position The local position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the world position should be copied to\r\n */\r\n public getAbsolutePositionFromLocalToRef(position: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n }\r\n\r\n /**\r\n * Get the local position of a point that is in world space\r\n * @param position The world position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The local position\r\n */\r\n public getLocalPositionFromAbsolute(position: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getLocalPositionFromAbsoluteToRef(position, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get the local position of a point that is in world space and copy it to the result param\r\n * @param position The world position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the local position should be copied to\r\n */\r\n public getLocalPositionFromAbsoluteToRef(position: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n\r\n tmat.invert();\r\n\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n }\r\n\r\n /**\r\n * Set the current local matrix as the restMatrix for this bone.\r\n */\r\n public setCurrentPoseAsRest(): void {\r\n this.setRestMatrix(this.getLocalMatrix());\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"bone.js","sourceRoot":"","sources":["../../../../dev/core/src/Bones/bone.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAK3C;;;GAGG;AACH,MAAM,OAAO,IAAK,SAAQ,IAAI;IA+C1B,gBAAgB;IAChB,IAAI,OAAO;QACP,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,gBAAgB;IAChB,IAAI,OAAO,CAAC,KAAa;QACrB,oCAAoC;QACpC,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YAC3E,OAAO;SACV;QAED,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC,sCAAsC;QAEnE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACpC,CAAC;IAED;;;;;;;;;OASG;IACH;IACI;;OAEG;IACI,IAAY,EACnB,QAAkB,EAClB,aAA6B,IAAI,EACjC,cAAgC,IAAI,EACpC,aAA+B,IAAI,EACnC,aAA+B,IAAI,EACnC,QAA0B,IAAI;;QAE9B,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;QAR1B,SAAI,GAAJ,I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from \"../Misc/arrayTools\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport { Node } from \"../node\";\r\nimport { Space } from \"../Maths/math.axis\";\r\n\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { AnimationPropertiesOverride } from \"../Animations/animationPropertiesOverride\";\r\n\r\n/**\r\n * Class used to store bone information\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\r\n */\r\nexport class Bone extends Node {\r\n private static _TmpVecs: Vector3[] = ArrayTools.BuildArray(2, Vector3.Zero);\r\n private static _TmpQuat = Quaternion.Identity();\r\n private static _TmpMats: Matrix[] = ArrayTools.BuildArray(5, Matrix.Identity);\r\n\r\n /**\r\n * Gets the list of child bones\r\n */\r\n public children = new Array<Bone>();\r\n\r\n /** Gets the animations associated with this bone */\r\n public animations = new Array<Animation>();\r\n\r\n /**\r\n * Gets or sets bone length\r\n */\r\n public length: number;\r\n\r\n /**\r\n * @internal Internal only\r\n * Set this value to map this bone to a different index in the transform matrices\r\n * Set this value to -1 to exclude the bone from the transform matrices\r\n */\r\n public _index: Nullable<number> = null;\r\n\r\n private _skeleton: Skeleton;\r\n private _localMatrix: Matrix; // transformation of the bone, in local space\r\n private _absoluteMatrix: Matrix; // transformation of the bone, in world space (relative to the skeleton root)\r\n private _bindMatrix: Matrix; // the bind matrix, in local space\r\n private _absoluteBindMatrix: Matrix; // the bind matrix, in world space (relative to the skeleton root)\r\n private _absoluteInverseBindMatrix: Matrix; // the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n private _finalMatrix: Matrix; // the final matrix used to transform vertices of the mesh according to the bone, in world space (relative to the skeleton root). It is the multiplication of _absoluteInverseBindMatrix with _absoluteMatrix.\r\n private _restMatrix: Matrix; // a matrix for the exclusive use of the end user (not used internally by the framework), in local space\r\n private _scalingDeterminant = 1;\r\n\r\n private _localScaling: Vector3;\r\n private _localRotation: Quaternion;\r\n private _localPosition: Vector3;\r\n private _needToDecompose = true;\r\n private _needToCompose = false;\r\n\r\n /** @internal */\r\n public _linkedTransformNode: Nullable<TransformNode> = null;\r\n\r\n /** @internal */\r\n public _waitingTransformNodeId: Nullable<string> = null;\r\n\r\n /** @internal */\r\n get _matrix(): Matrix {\r\n this._compose();\r\n return this._localMatrix;\r\n }\r\n\r\n /** @internal */\r\n set _matrix(value: Matrix) {\r\n // skip if the matrices are the same\r\n if (value.updateFlag === this._localMatrix.updateFlag && !this._needToCompose) {\r\n return;\r\n }\r\n\r\n this._needToCompose = false; // in case there was a pending compose\r\n\r\n this._localMatrix.copyFrom(value);\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n /**\r\n * Create a new bone\r\n * @param name defines the bone name\r\n * @param skeleton defines the parent skeleton\r\n * @param parentBone defines the parent (can be null if the bone is the root)\r\n * @param localMatrix defines the local matrix (default: identity)\r\n * @param restMatrix defines the rest matrix (default: localMatrix)\r\n * @param bindMatrix defines the bind matrix (default: localMatrix)\r\n * @param index defines index of the bone in the hierarchy (default: null)\r\n */\r\n constructor(\r\n /**\r\n * defines the bone name\r\n */\r\n public name: string,\r\n skeleton: Skeleton,\r\n parentBone: Nullable<Bone> = null,\r\n localMatrix: Nullable<Matrix> = null,\r\n restMatrix: Nullable<Matrix> = null,\r\n bindMatrix: Nullable<Matrix> = null,\r\n index: Nullable<number> = null\r\n ) {\r\n super(name, skeleton.getScene());\r\n this._skeleton = skeleton;\r\n this._localMatrix = localMatrix?.clone() ?? Matrix.Identity();\r\n this._restMatrix = restMatrix ?? this._localMatrix.clone();\r\n this._bindMatrix = bindMatrix ?? this._localMatrix.clone();\r\n this._index = index;\r\n\r\n this._absoluteMatrix = new Matrix();\r\n this._absoluteBindMatrix = new Matrix();\r\n this._absoluteInverseBindMatrix = new Matrix();\r\n this._finalMatrix = new Matrix();\r\n\r\n skeleton.bones.push(this);\r\n\r\n this.setParent(parentBone, false);\r\n\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n /**\r\n * Gets the current object class name.\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"Bone\";\r\n }\r\n\r\n // Members\r\n\r\n /**\r\n * Gets the parent skeleton\r\n * @returns a skeleton\r\n */\r\n public getSkeleton(): Skeleton {\r\n return this._skeleton;\r\n }\r\n\r\n public get parent(): Bone {\r\n return this._parentNode as Bone;\r\n }\r\n\r\n /**\r\n * Gets parent bone\r\n * @returns a bone or null if the bone is the root of the bone hierarchy\r\n */\r\n public getParent(): Nullable<Bone> {\r\n return this.parent;\r\n }\r\n\r\n /**\r\n * Returns an array containing the children of the bone\r\n * @returns an array containing the children of the bone (can be empty if the bone has no children)\r\n */\r\n public getChildren(): Array<Bone> {\r\n return this.children;\r\n }\r\n\r\n /**\r\n * Gets the node index in matrix array generated for rendering\r\n * @returns the node index\r\n */\r\n public getIndex(): number {\r\n return this._index === null ? this.getSkeleton().bones.indexOf(this) : this._index;\r\n }\r\n\r\n public set parent(newParent: Nullable<Bone>) {\r\n this.setParent(newParent);\r\n }\r\n\r\n /**\r\n * Sets the parent bone\r\n * @param parent defines the parent (can be null if the bone is the root)\r\n * @param updateAbsoluteBindMatrices defines if the absolute bind and absolute inverse bind matrices must be updated\r\n */\r\n public setParent(parent: Nullable<Bone>, updateAbsoluteBindMatrices: boolean = true): void {\r\n if (this.parent === parent) {\r\n return;\r\n }\r\n\r\n if (this.parent) {\r\n const index = this.parent.children.indexOf(this);\r\n if (index !== -1) {\r\n this.parent.children.splice(index, 1);\r\n }\r\n }\r\n\r\n this._parentNode = parent;\r\n\r\n if (this.parent) {\r\n this.parent.children.push(this);\r\n }\r\n\r\n if (updateAbsoluteBindMatrices) {\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n this.markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the local matrix\r\n * @returns the local matrix\r\n */\r\n public getLocalMatrix(): Matrix {\r\n this._compose();\r\n return this._localMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bind matrix\r\n * @returns the bind matrix\r\n */\r\n public getBindMatrix(): Matrix {\r\n return this._bindMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bind matrix.\r\n * @returns the bind matrix\r\n * @deprecated Please use getBindMatrix instead\r\n */\r\n public getBaseMatrix(): Matrix {\r\n return this.getBindMatrix();\r\n }\r\n\r\n /**\r\n * Gets the rest matrix\r\n * @returns the rest matrix\r\n */\r\n public getRestMatrix(): Matrix {\r\n return this._restMatrix;\r\n }\r\n\r\n /**\r\n * Gets the rest matrix\r\n * @returns the rest matrix\r\n * @deprecated Please use getRestMatrix instead\r\n */\r\n public getRestPose(): Matrix {\r\n return this.getRestMatrix();\r\n }\r\n\r\n /**\r\n * Sets the rest matrix\r\n * @param matrix the local-space rest matrix to set for this bone\r\n */\r\n public setRestMatrix(matrix: Matrix): void {\r\n this._restMatrix.copyFrom(matrix);\r\n }\r\n\r\n /**\r\n * Sets the rest matrix\r\n * @param matrix the local-space rest to set for this bone\r\n * @deprecated Please use setRestMatrix instead\r\n */\r\n public setRestPose(matrix: Matrix): void {\r\n this.setRestMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Gets the bind matrix\r\n * @returns the bind matrix\r\n * @deprecated Please use getBindMatrix instead\r\n */\r\n public getBindPose(): Matrix {\r\n return this.getBindMatrix();\r\n }\r\n\r\n /**\r\n * Sets the bind matrix\r\n * This will trigger a recomputation of the absolute bind and absolute inverse bind matrices for this bone and its children\r\n * Note that the local matrix will also be set with the matrix passed in parameter!\r\n * @param matrix the local-space bind matrix to set for this bone\r\n */\r\n public setBindMatrix(matrix: Matrix): void {\r\n this.updateMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Sets the bind matrix\r\n * @param matrix the local-space bind to set for this bone\r\n * @deprecated Please use setBindMatrix instead\r\n */\r\n public setBindPose(matrix: Matrix): void {\r\n this.setBindMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Gets the matrix used to store the final world transformation of the bone (ie. the matrix sent to shaders)\r\n */\r\n public getFinalMatrix(): Matrix {\r\n return this._finalMatrix;\r\n }\r\n\r\n /**\r\n * Gets the matrix used to store the final world transformation of the bone (ie. the matrix sent to shaders)\r\n * @deprecated Please use getFinalMatrix instead\r\n */\r\n public getWorldMatrix(): Matrix {\r\n return this.getFinalMatrix();\r\n }\r\n\r\n /**\r\n * Sets the local matrix to the rest matrix\r\n */\r\n public returnToRest(): void {\r\n if (this._linkedTransformNode) {\r\n const localScaling = TmpVectors.Vector3[0];\r\n const localRotation = TmpVectors.Quaternion[0];\r\n const localPosition = TmpVectors.Vector3[1];\r\n\r\n this.getRestMatrix().decompose(localScaling, localRotation, localPosition);\r\n\r\n this._linkedTransformNode.position.copyFrom(localPosition);\r\n this._linkedTransformNode.rotationQuaternion = this._linkedTransformNode.rotationQuaternion ?? Quaternion.Identity();\r\n this._linkedTransformNode.rotationQuaternion.copyFrom(localRotation);\r\n this._linkedTransformNode.scaling.copyFrom(localScaling);\r\n } else {\r\n this._matrix = this._restMatrix;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n * @returns the inverse bind matrix, in world space\r\n */\r\n public getAbsoluteInverseBindMatrix(): Matrix {\r\n return this._absoluteInverseBindMatrix;\r\n }\r\n\r\n /**\r\n * Gets the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n * @returns the inverse bind matrix, in world space\r\n * @deprecated Please use getAbsoluteInverseBindMatrix instead\r\n */\r\n public getInvertedAbsoluteTransform(): Matrix {\r\n return this.getAbsoluteInverseBindMatrix();\r\n }\r\n\r\n /**\r\n * Gets the bone matrix, in world space (relative to the skeleton root)\r\n * @returns the bone matrix, in world space\r\n */\r\n public getAbsoluteMatrix(): Matrix {\r\n return this._absoluteMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bone matrix, in world space (relative to the skeleton root)\r\n * @returns the bone matrix, in world space\r\n * @deprecated Please use getAbsoluteMatrix instead\r\n */\r\n public getAbsoluteTransform(): Matrix {\r\n return this._absoluteMatrix;\r\n }\r\n\r\n /**\r\n * Links with the given transform node.\r\n * The local matrix of this bone is overwritten by the transform of the node every frame.\r\n * @param transformNode defines the transform node to link to\r\n */\r\n public linkTransformNode(transformNode: Nullable<TransformNode>): void {\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode--;\r\n }\r\n\r\n this._linkedTransformNode = transformNode;\r\n\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode++;\r\n }\r\n }\r\n\r\n // Properties (matches TransformNode properties)\r\n\r\n /**\r\n * Gets the node used to drive the bone's transformation\r\n * @returns a transform node or null\r\n */\r\n public getTransformNode() {\r\n return this._linkedTransformNode;\r\n }\r\n\r\n /** Gets or sets current position (in local space) */\r\n public get position(): Vector3 {\r\n this._decompose();\r\n return this._localPosition;\r\n }\r\n\r\n public set position(newPosition: Vector3) {\r\n this._decompose();\r\n this._localPosition.copyFrom(newPosition);\r\n\r\n this._markAsDirtyAndCompose();\r\n }\r\n\r\n /** Gets or sets current rotation (in local space) */\r\n public get rotation(): Vector3 {\r\n return this.getRotation();\r\n }\r\n\r\n public set rotation(newRotation: Vector3) {\r\n this.setRotation(newRotation);\r\n }\r\n\r\n /** Gets or sets current rotation quaternion (in local space) */\r\n public get rotationQuaternion() {\r\n this._decompose();\r\n return this._localRotation;\r\n }\r\n\r\n public set rotationQuaternion(newRotation: Quaternion) {\r\n this.setRotationQuaternion(newRotation);\r\n }\r\n\r\n /** Gets or sets current scaling (in local space) */\r\n public get scaling(): Vector3 {\r\n return this.getScale();\r\n }\r\n\r\n public set scaling(newScaling: Vector3) {\r\n this.setScale(newScaling);\r\n }\r\n\r\n /**\r\n * Gets the animation properties override\r\n */\r\n public get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride> {\r\n return this._skeleton.animationPropertiesOverride;\r\n }\r\n\r\n // Methods\r\n private _decompose() {\r\n if (!this._needToDecompose) {\r\n return;\r\n }\r\n\r\n this._needToDecompose = false;\r\n\r\n if (!this._localScaling) {\r\n this._localScaling = Vector3.Zero();\r\n this._localRotation = Quaternion.Zero();\r\n this._localPosition = Vector3.Zero();\r\n }\r\n this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition);\r\n }\r\n\r\n private _compose() {\r\n if (!this._needToCompose) {\r\n return;\r\n }\r\n\r\n if (!this._localScaling) {\r\n this._needToCompose = false;\r\n return;\r\n }\r\n\r\n this._needToCompose = false;\r\n Matrix.ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix);\r\n }\r\n\r\n /**\r\n * Update the bind (and optionally the local) matrix\r\n * @param bindMatrix defines the new matrix to set to the bind/local matrix, in local space\r\n * @param updateAbsoluteBindMatrices defines if the absolute bind and absolute inverse bind matrices must be recomputed (default: true)\r\n * @param updateLocalMatrix defines if the local matrix should also be updated with the matrix passed in parameter (default: true)\r\n */\r\n public updateMatrix(bindMatrix: Matrix, updateAbsoluteBindMatrices = true, updateLocalMatrix = true): void {\r\n this._bindMatrix.copyFrom(bindMatrix);\r\n\r\n if (updateAbsoluteBindMatrices) {\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n if (updateLocalMatrix) {\r\n this._matrix = bindMatrix;\r\n } else {\r\n this.markAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updateAbsoluteBindMatrices(bindMatrix?: Matrix, updateChildren = true): void {\r\n if (!bindMatrix) {\r\n bindMatrix = this._bindMatrix;\r\n }\r\n\r\n if (this.parent) {\r\n bindMatrix.multiplyToRef(this.parent._absoluteBindMatrix, this._absoluteBindMatrix);\r\n } else {\r\n this._absoluteBindMatrix.copyFrom(bindMatrix);\r\n }\r\n\r\n this._absoluteBindMatrix.invertToRef(this._absoluteInverseBindMatrix);\r\n\r\n if (updateChildren) {\r\n for (let index = 0; index < this.children.length; index++) {\r\n this.children[index]._updateAbsoluteBindMatrices();\r\n }\r\n }\r\n\r\n this._scalingDeterminant = this._absoluteBindMatrix.determinant() < 0 ? -1 : 1;\r\n }\r\n\r\n /**\r\n * Flag the bone as dirty (Forcing it to update everything)\r\n * @returns this bone\r\n */\r\n public markAsDirty(): Bone {\r\n this._currentRenderId++;\r\n this._childUpdateId++;\r\n this._skeleton._markAsDirty();\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n public _markAsDirtyAndCompose() {\r\n this.markAsDirty();\r\n this._needToCompose = true;\r\n }\r\n\r\n private _markAsDirtyAndDecompose() {\r\n this.markAsDirty();\r\n this._needToDecompose = true;\r\n }\r\n\r\n private _updatePosition(vec: Vector3, space = Space.LOCAL, tNode?: TransformNode, translationMode = true): void {\r\n const lm = this.getLocalMatrix();\r\n\r\n if (space == Space.LOCAL) {\r\n if (translationMode) {\r\n lm.addAtIndex(12, vec.x);\r\n lm.addAtIndex(13, vec.y);\r\n lm.addAtIndex(14, vec.z);\r\n } else {\r\n lm.setTranslationFromFloats(vec.x, vec.y, vec.z);\r\n }\r\n } else {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n const tvec = Bone._TmpVecs[0];\r\n\r\n if (this.parent) {\r\n if (tNode && wm) {\r\n tmat.copyFrom(this.parent.getAbsoluteMatrix());\r\n tmat.multiplyToRef(wm, tmat);\r\n } else {\r\n tmat.copyFrom(this.parent.getAbsoluteMatrix());\r\n }\r\n } else {\r\n Matrix.IdentityToRef(tmat);\r\n }\r\n\r\n if (translationMode) {\r\n tmat.setTranslationFromFloats(0, 0, 0);\r\n }\r\n tmat.invert();\r\n Vector3.TransformCoordinatesToRef(vec, tmat, tvec);\r\n\r\n if (translationMode) {\r\n lm.addAtIndex(12, tvec.x);\r\n lm.addAtIndex(13, tvec.y);\r\n lm.addAtIndex(14, tvec.z);\r\n } else {\r\n lm.setTranslationFromFloats(tvec.x, tvec.y, tvec.z);\r\n }\r\n }\r\n\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n /**\r\n * Translate the bone in local or world space\r\n * @param vec The amount to translate the bone\r\n * @param space The space that the translation is in (default: Space.LOCAL)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public translate(vec: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this._updatePosition(vec, space, tNode, true);\r\n }\r\n\r\n /**\r\n * Set the position of the bone in local or world space\r\n * @param position The position to set the bone\r\n * @param space The space that the position is in (default: Space.LOCAL)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setPosition(position: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this._updatePosition(position, space, tNode, false);\r\n }\r\n\r\n /**\r\n * Set the absolute position of the bone (world space)\r\n * @param position The position to set the bone\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setAbsolutePosition(position: Vector3, tNode?: TransformNode) {\r\n this.setPosition(position, Space.WORLD, tNode);\r\n }\r\n\r\n /**\r\n * Scale the bone on the x, y and z axes (in local space)\r\n * @param x The amount to scale the bone on the x axis\r\n * @param y The amount to scale the bone on the y axis\r\n * @param z The amount to scale the bone on the z axis\r\n * @param scaleChildren sets this to true if children of the bone should be scaled as well (false by default)\r\n */\r\n public scale(x: number, y: number, z: number, scaleChildren = false): void {\r\n const locMat = this.getLocalMatrix();\r\n\r\n // Apply new scaling on top of current local matrix\r\n const scaleMat = Bone._TmpMats[0];\r\n Matrix.ScalingToRef(x, y, z, scaleMat);\r\n scaleMat.multiplyToRef(locMat, locMat);\r\n\r\n // Invert scaling matrix and apply the inverse to all children\r\n scaleMat.invert();\r\n\r\n for (const child of this.children) {\r\n const cm = child.getLocalMatrix();\r\n cm.multiplyToRef(scaleMat, cm);\r\n cm.multiplyAtIndex(12, x);\r\n cm.multiplyAtIndex(13, y);\r\n cm.multiplyAtIndex(14, z);\r\n\r\n child._markAsDirtyAndDecompose();\r\n }\r\n\r\n this._markAsDirtyAndDecompose();\r\n\r\n if (scaleChildren) {\r\n for (const child of this.children) {\r\n child.scale(x, y, z, scaleChildren);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the bone scaling in local space\r\n * @param scale defines the scaling vector\r\n */\r\n public setScale(scale: Vector3): void {\r\n this._decompose();\r\n this._localScaling.copyFrom(scale);\r\n this._markAsDirtyAndCompose();\r\n }\r\n\r\n /**\r\n * Gets the current scaling in local space\r\n * @returns the current scaling vector\r\n */\r\n public getScale(): Vector3 {\r\n this._decompose();\r\n return this._localScaling;\r\n }\r\n\r\n /**\r\n * Gets the current scaling in local space and stores it in a target vector\r\n * @param result defines the target vector\r\n */\r\n public getScaleToRef(result: Vector3) {\r\n this._decompose();\r\n result.copyFrom(this._localScaling);\r\n }\r\n\r\n /**\r\n * Set the yaw, pitch, and roll of the bone in local or world space\r\n * @param yaw The rotation of the bone on the y axis\r\n * @param pitch The rotation of the bone on the x axis\r\n * @param roll The rotation of the bone on the z axis\r\n * @param space The space that the axes of rotation are in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setYawPitchRoll(yaw: number, pitch: number, roll: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, quat);\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Add a rotation to the bone on an axis in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param amount The amount to rotate the bone\r\n * @param space The space that the axis is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public rotate(axis: Vector3, amount: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n const rmat = Bone._TmpMats[0];\r\n rmat.setTranslationFromFloats(0, 0, 0);\r\n Matrix.RotationAxisToRef(axis, amount, rmat);\r\n this._rotateWithMatrix(rmat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the rotation of the bone to a particular axis angle in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param angle The angle that the bone should be rotated to\r\n * @param space The space that the axis is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setAxisAngle(axis: Vector3, angle: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.RotationAxisToRef(axis, angle, quat);\r\n\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.RotationAxisToRef(axis, angle, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the euler rotation of the bone in local or world space\r\n * @param rotation The euler rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotation(rotation: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the quaternion rotation of the bone in local or world space\r\n * @param quat The quaternion rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotationQuaternion(quat: Quaternion, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n this._decompose();\r\n this._localRotation.copyFrom(quat);\r\n\r\n this._markAsDirtyAndCompose();\r\n\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.FromQuaternionToRef(quat, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the rotation matrix of the bone in local or world space\r\n * @param rotMat The rotation matrix that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotationMatrix(rotMat: Matrix, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.FromRotationMatrixToRef(rotMat, quat);\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat2 = Bone._TmpMats[1];\r\n rotMat2.copyFrom(rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat2);\r\n\r\n this._rotateWithMatrix(rotMat2, space, tNode);\r\n }\r\n\r\n private _rotateWithMatrix(rmat: Matrix, space = Space.LOCAL, tNode?: TransformNode): void {\r\n const lmat = this.getLocalMatrix();\r\n const lx = lmat.m[12];\r\n const ly = lmat.m[13];\r\n const lz = lmat.m[14];\r\n const parent = this.getParent();\r\n const parentScale = Bone._TmpMats[3];\r\n const parentScaleInv = Bone._TmpMats[4];\r\n\r\n if (parent && space == Space.WORLD) {\r\n if (tNode) {\r\n parentScale.copyFrom(tNode.getWorldMatrix());\r\n parent.getAbsoluteMatrix().multiplyToRef(parentScale, parentScale);\r\n } else {\r\n parentScale.copyFrom(parent.getAbsoluteMatrix());\r\n }\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n } else {\r\n if (space == Space.WORLD && tNode) {\r\n parentScale.copyFrom(tNode.getWorldMatrix());\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n } else {\r\n lmat.multiplyToRef(rmat, lmat);\r\n }\r\n }\r\n\r\n lmat.setTranslationFromFloats(lx, ly, lz);\r\n\r\n this.computeAbsoluteMatrices();\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n private _getAbsoluteInverseMatrixUnscaledToRef(rotMatInv: Matrix, tNode?: TransformNode): boolean {\r\n const scaleMatrix = Bone._TmpMats[2];\r\n rotMatInv.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode) {\r\n rotMatInv.multiplyToRef(tNode.getWorldMatrix(), rotMatInv);\r\n Matrix.ScalingToRef(tNode.scaling.x, tNode.scaling.y, tNode.scaling.z, scaleMatrix);\r\n } else {\r\n Matrix.IdentityToRef(scaleMatrix);\r\n }\r\n\r\n rotMatInv.invert();\r\n if (isNaN(rotMatInv.m[0])) {\r\n // Matrix failed to invert.\r\n // This can happen if scale is zero for example.\r\n return false;\r\n }\r\n\r\n scaleMatrix.multiplyAtIndex(0, this._scalingDeterminant);\r\n rotMatInv.multiplyToRef(scaleMatrix, rotMatInv);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Get the position of the bone in local or world space\r\n * @param space The space that the returned position is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The position of the bone\r\n */\r\n public getPosition(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const pos = Vector3.Zero();\r\n\r\n this.getPositionToRef(space, tNode, pos);\r\n\r\n return pos;\r\n }\r\n\r\n /**\r\n * Copy the position of the bone to a vector3 in local or world space\r\n * @param space The space that the returned position is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 to copy the position to\r\n */\r\n public getPositionToRef(space = Space.LOCAL, tNode: Nullable<TransformNode>, result: Vector3): void {\r\n if (space == Space.LOCAL) {\r\n const lm = this.getLocalMatrix();\r\n\r\n result.x = lm.m[12];\r\n result.y = lm.m[13];\r\n result.z = lm.m[14];\r\n } else {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n let tmat = Bone._TmpMats[0];\r\n\r\n if (tNode && wm) {\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n tmat.multiplyToRef(wm, tmat);\r\n } else {\r\n tmat = this.getAbsoluteMatrix();\r\n }\r\n\r\n result.x = tmat.m[12];\r\n result.y = tmat.m[13];\r\n result.z = tmat.m[14];\r\n }\r\n }\r\n\r\n /**\r\n * Get the absolute position of the bone (world space)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The absolute position of the bone\r\n */\r\n public getAbsolutePosition(tNode: Nullable<TransformNode> = null): Vector3 {\r\n const pos = Vector3.Zero();\r\n\r\n this.getPositionToRef(Space.WORLD, tNode, pos);\r\n\r\n return pos;\r\n }\r\n\r\n /**\r\n * Copy the absolute position of the bone (world space) to the result param\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 to copy the absolute position to\r\n */\r\n public getAbsolutePositionToRef(tNode: TransformNode, result: Vector3) {\r\n this.getPositionToRef(Space.WORLD, tNode, result);\r\n }\r\n\r\n /**\r\n * Compute the absolute matrices of this bone and its children\r\n */\r\n public computeAbsoluteMatrices(): void {\r\n this._compose();\r\n\r\n if (this.parent) {\r\n this._localMatrix.multiplyToRef(this.parent._absoluteMatrix, this._absoluteMatrix);\r\n } else {\r\n this._absoluteMatrix.copyFrom(this._localMatrix);\r\n\r\n const poseMatrix = this._skeleton.getPoseMatrix();\r\n\r\n if (poseMatrix) {\r\n this._absoluteMatrix.multiplyToRef(poseMatrix, this._absoluteMatrix);\r\n }\r\n }\r\n\r\n const children = this.children;\r\n const len = children.length;\r\n\r\n for (let i = 0; i < len; i++) {\r\n children[i].computeAbsoluteMatrices();\r\n }\r\n }\r\n\r\n /**\r\n * Compute the absolute matrices of this bone and its children\r\n * @deprecated Please use computeAbsoluteMatrices instead\r\n */\r\n public computeAbsoluteTransforms(): void {\r\n this.computeAbsoluteMatrices();\r\n }\r\n\r\n /**\r\n * Get the world direction from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The world direction\r\n */\r\n public getDirection(localAxis: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getDirectionToRef(localAxis, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the world direction to a vector3 from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the world direction will be copied to\r\n */\r\n public getDirectionToRef(localAxis: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const mat = Bone._TmpMats[0];\r\n\r\n mat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n mat.multiplyToRef(wm, mat);\r\n }\r\n\r\n Vector3.TransformNormalToRef(localAxis, mat, result);\r\n\r\n result.normalize();\r\n }\r\n\r\n /**\r\n * Get the euler rotation of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The euler rotation\r\n */\r\n public getRotation(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getRotationToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the rotation should be copied to\r\n */\r\n public getRotationToRef(space = Space.LOCAL, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n const quat = Bone._TmpQuat;\r\n\r\n this.getRotationQuaternionToRef(space, tNode, quat);\r\n\r\n quat.toEulerAnglesToRef(result);\r\n }\r\n\r\n /**\r\n * Get the quaternion rotation of the bone in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The quaternion rotation\r\n */\r\n public getRotationQuaternion(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Quaternion {\r\n const result = Quaternion.Identity();\r\n\r\n this.getRotationQuaternionToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n public getRotationQuaternionToRef(space = Space.LOCAL, tNode: Nullable<TransformNode> = null, result: Quaternion): void {\r\n if (space == Space.LOCAL) {\r\n this._decompose();\r\n result.copyFrom(this._localRotation);\r\n } else {\r\n const mat = Bone._TmpMats[0];\r\n const amat = this.getAbsoluteMatrix();\r\n\r\n if (tNode) {\r\n amat.multiplyToRef(tNode.getWorldMatrix(), mat);\r\n } else {\r\n mat.copyFrom(amat);\r\n }\r\n\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n\r\n mat.decompose(undefined, result, undefined);\r\n }\r\n }\r\n\r\n /**\r\n * Get the rotation matrix of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The rotation matrix\r\n */\r\n public getRotationMatrix(space = Space.LOCAL, tNode: TransformNode): Matrix {\r\n const result = Matrix.Identity();\r\n\r\n this.getRotationMatrixToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n public getRotationMatrixToRef(space = Space.LOCAL, tNode: TransformNode, result: Matrix): void {\r\n if (space == Space.LOCAL) {\r\n this.getLocalMatrix().getRotationMatrixToRef(result);\r\n } else {\r\n const mat = Bone._TmpMats[0];\r\n const amat = this.getAbsoluteMatrix();\r\n\r\n if (tNode) {\r\n amat.multiplyToRef(tNode.getWorldMatrix(), mat);\r\n } else {\r\n mat.copyFrom(amat);\r\n }\r\n\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n\r\n mat.getRotationMatrixToRef(result);\r\n }\r\n }\r\n\r\n /**\r\n * Get the world position of a point that is in the local space of the bone\r\n * @param position The local position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The world position\r\n */\r\n public getAbsolutePositionFromLocal(position: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getAbsolutePositionFromLocalToRef(position, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get the world position of a point that is in the local space of the bone and copy it to the result param\r\n * @param position The local position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the world position should be copied to\r\n */\r\n public getAbsolutePositionFromLocalToRef(position: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n }\r\n\r\n /**\r\n * Get the local position of a point that is in world space\r\n * @param position The world position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The local position\r\n */\r\n public getLocalPositionFromAbsolute(position: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getLocalPositionFromAbsoluteToRef(position, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get the local position of a point that is in world space and copy it to the result param\r\n * @param position The world position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the local position should be copied to\r\n */\r\n public getLocalPositionFromAbsoluteToRef(position: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n\r\n tmat.invert();\r\n\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n }\r\n\r\n /**\r\n * Set the current local matrix as the restMatrix for this bone.\r\n */\r\n public setCurrentPoseAsRest(): void {\r\n this.setRestMatrix(this.getLocalMatrix());\r\n }\r\n}\r\n"]}
|
package/Cameras/freeCamera.js
CHANGED
|
@@ -235,16 +235,16 @@ export class FreeCamera extends TargetCamera {
|
|
|
235
235
|
this._newPosition.subtractToRef(this._oldPosition, this._diffPosition);
|
|
236
236
|
if (this._diffPosition.length() > Engine.CollisionsEpsilon) {
|
|
237
237
|
this.position.addToRef(this._diffPosition, this._deferredPositionUpdate);
|
|
238
|
-
// call onCollide, if defined. Note that in case of deferred update, the actual position change might happen in the next frame.
|
|
239
|
-
if (this.onCollide && collidedMesh) {
|
|
240
|
-
this.onCollide(collidedMesh);
|
|
241
|
-
}
|
|
242
238
|
if (!this._deferOnly) {
|
|
243
239
|
this.position.copyFrom(this._deferredPositionUpdate);
|
|
244
240
|
}
|
|
245
241
|
else {
|
|
246
242
|
this._deferredUpdated = true;
|
|
247
243
|
}
|
|
244
|
+
// call onCollide, if defined. Note that in case of deferred update, the actual position change might happen in the next frame.
|
|
245
|
+
if (this.onCollide && collidedMesh) {
|
|
246
|
+
this.onCollide(collidedMesh);
|
|
247
|
+
}
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
250
|
this.inputs = new FreeCameraInputsManager(this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"freeCamera.js","sourceRoot":"","sources":["../../../../dev/core/src/Cameras/freeCamera.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAItC;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,YAAY;IAkCxC;;;OAGG;IACH,IAAW,kBAAkB;QACzB,MAAM,KAAK,GAAyB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClE,IAAI,KAAK,EAAE;YACP,OAAO,KAAK,CAAC,kBAAkB,CAAC;SACnC;QAED,OAAO,CAAC,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,IAAW,kBAAkB,CAAC,KAAa;QACvC,MAAM,KAAK,GAAyB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClE,IAAI,KAAK,EAAE;YACP,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC;SACpC;IACL,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,MAAM,QAAQ,GAAgC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC/E,IAAI,QAAQ,EAA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I,YAAY;QACf,OAAO,YAAY,CAAC;IACxB,CAAC;CACJ;AA7aU;IADN,kBAAkB,EAAE;6CACuB;AAQrC;IADN,kBAAkB,EAAE;mDACyB;AAMvC;IADN,SAAS,EAAE;mDACmB;AAMxB;IADN,SAAS,EAAE;gDACgB","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { serializeAsVector3, serialize } from \"../Misc/decorators\";\r\nimport { Vector3, Vector2 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { TargetCamera } from \"./targetCamera\";\r\nimport { FreeCameraInputsManager } from \"./freeCameraInputsManager\";\r\nimport type { FreeCameraMouseInput } from \"../Cameras/Inputs/freeCameraMouseInput\";\r\nimport type { FreeCameraKeyboardMoveInput } from \"../Cameras/Inputs/freeCameraKeyboardMoveInput\";\r\nimport { Tools } from \"../Misc/tools\";\r\n\r\nimport type { Collider } from \"../Collisions/collider\";\r\n\r\n/**\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like the gamepad.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#universal-camera\r\n */\r\nexport class FreeCamera extends TargetCamera {\r\n /**\r\n * Define the collision ellipsoid of the camera.\r\n * This is helpful to simulate a camera body like the player body around the camera\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions#arcrotatecamera\r\n */\r\n @serializeAsVector3()\r\n public ellipsoid = new Vector3(0.5, 1, 0.5);\r\n\r\n /**\r\n * Define an offset for the position of the ellipsoid around the camera.\r\n * This can be helpful to determine the center of the body near the gravity center of the body\r\n * instead of its head.\r\n */\r\n @serializeAsVector3()\r\n public ellipsoidOffset = new Vector3(0, 0, 0);\r\n\r\n /**\r\n * Enable or disable collisions of the camera with the rest of the scene objects.\r\n */\r\n @serialize()\r\n public checkCollisions = false;\r\n\r\n /**\r\n * Enable or disable gravity on the camera.\r\n */\r\n @serialize()\r\n public applyGravity = false;\r\n\r\n /**\r\n * Define the input manager associated to the camera.\r\n */\r\n public inputs: FreeCameraInputsManager;\r\n\r\n /**\r\n * Gets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n public get angularSensibility(): number {\r\n const mouse = <FreeCameraMouseInput>this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n return mouse.angularSensibility;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Sets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n public set angularSensibility(value: number) {\r\n const mouse = <FreeCameraMouseInput>this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n mouse.angularSensibility = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\r\n */\r\n public get keysUp(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysUp(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the upward move of the camera.\r\n */\r\n public get keysUpward(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUpward;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysUpward(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUpward = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\r\n */\r\n public get keysDown(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysDown(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the downward move of the camera.\r\n */\r\n public get keysDownward(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDownward;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysDownward(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDownward = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n public get keysLeft(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysLeft(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n public get keysRight(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysRight(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left rotation move of the camera.\r\n */\r\n public get keysRotateLeft(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRotateLeft;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysRotateLeft(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRotateLeft = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right rotation move of the camera.\r\n */\r\n public get keysRotateRight(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRotateRight;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysRotateRight(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRotateRight = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the up rotation move of the camera.\r\n */\r\n public get keysRotateUp(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRotateUp;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysRotateUp(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRotateUp = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the down rotation move of the camera.\r\n */\r\n public get keysRotateDown(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRotateDown;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysRotateDown(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRotateDown = value;\r\n }\r\n }\r\n\r\n /**\r\n * Event raised when the camera collide with a mesh in the scene.\r\n */\r\n public onCollide: (collidedMesh: AbstractMesh) => void;\r\n\r\n private _collider: Collider;\r\n private _needMoveForGravity = false;\r\n private _oldPosition = Vector3.Zero();\r\n private _diffPosition = Vector3.Zero();\r\n private _newPosition = Vector3.Zero();\r\n\r\n /** @internal */\r\n public _localDirection: Vector3;\r\n /** @internal */\r\n public _transformedDirection: Vector3;\r\n\r\n /**\r\n * Instantiates a Free Camera.\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like touch to this camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines whether the camera should be marked as active if not other active cameras have been defined\r\n */\r\n constructor(name: string, position: Vector3, scene?: Scene, setActiveOnSceneIfNoneActive = true) {\r\n super(name, position, scene, setActiveOnSceneIfNoneActive);\r\n this.inputs = new FreeCameraInputsManager(this);\r\n this.inputs.addKeyboard().addMouse();\r\n }\r\n\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n public attachControl(noPreventDefault?: boolean): void;\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param ignored defines an ignored parameter kept for backward compatibility.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n * BACK COMPAT SIGNATURE ONLY.\r\n */\r\n public attachControl(ignored: any, noPreventDefault?: boolean): void;\r\n /**\r\n * Attached controls to the current camera.\r\n * @param ignored defines an ignored parameter kept for backward compatibility.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n public attachControl(ignored?: any, noPreventDefault?: boolean): void {\r\n // eslint-disable-next-line prefer-rest-params\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n this.inputs.attachElement(noPreventDefault);\r\n }\r\n\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n */\r\n public detachControl(): void {\r\n this.inputs.detachElement();\r\n\r\n this.cameraDirection = new Vector3(0, 0, 0);\r\n this.cameraRotation = new Vector2(0, 0);\r\n }\r\n\r\n // Collisions\r\n private _collisionMask = -1;\r\n\r\n /**\r\n * Define a collision mask to limit the list of object the camera can collide with\r\n */\r\n public get collisionMask(): number {\r\n return this._collisionMask;\r\n }\r\n\r\n public set collisionMask(mask: number) {\r\n this._collisionMask = !isNaN(mask) ? mask : -1;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _collideWithWorld(displacement: Vector3): void {\r\n let globalPosition: Vector3;\r\n\r\n if (this.parent) {\r\n globalPosition = Vector3.TransformCoordinates(this.position, this.parent.getWorldMatrix());\r\n } else {\r\n globalPosition = this.position;\r\n }\r\n\r\n globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);\r\n this._oldPosition.addInPlace(this.ellipsoidOffset);\r\n\r\n const coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n\r\n this._collider._radius = this.ellipsoid;\r\n this._collider.collisionMask = this._collisionMask;\r\n\r\n //no need for clone, as long as gravity is not on.\r\n let actualDisplacement = displacement;\r\n\r\n //add gravity to the direction to prevent the dual-collision checking\r\n if (this.applyGravity) {\r\n //this prevents mending with cameraDirection, a global variable of the free camera class.\r\n actualDisplacement = displacement.add(this.getScene().gravity);\r\n }\r\n\r\n coordinator.getNewPosition(this._oldPosition, actualDisplacement, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n }\r\n\r\n private _onCollisionPositionChange = (collisionId: number, newPosition: Vector3, collidedMesh: Nullable<AbstractMesh> = null) => {\r\n this._newPosition.copyFrom(newPosition);\r\n\r\n this._newPosition.subtractToRef(this._oldPosition, this._diffPosition);\r\n\r\n if (this._diffPosition.length() > Engine.CollisionsEpsilon) {\r\n this.position.addToRef(this._diffPosition, this._deferredPositionUpdate);\r\n // call onCollide, if defined. Note that in case of deferred update, the actual position change might happen in the next frame.\r\n if (this.onCollide && collidedMesh) {\r\n this.onCollide(collidedMesh);\r\n }\r\n if (!this._deferOnly) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n } else {\r\n this._deferredUpdated = true;\r\n }\r\n }\r\n };\r\n\r\n /** @internal */\r\n public _checkInputs(): void {\r\n if (!this._localDirection) {\r\n this._localDirection = Vector3.Zero();\r\n this._transformedDirection = Vector3.Zero();\r\n }\r\n\r\n this.inputs.checkInputs();\r\n\r\n super._checkInputs();\r\n }\r\n\r\n /**\r\n * Enable movement without a user input. This allows gravity to always be applied.\r\n */\r\n public set needMoveForGravity(value: boolean) {\r\n this._needMoveForGravity = value;\r\n }\r\n\r\n /**\r\n * When true, gravity is applied whether there is user input or not.\r\n */\r\n public get needMoveForGravity(): boolean {\r\n return this._needMoveForGravity;\r\n }\r\n\r\n /** @internal */\r\n public _decideIfNeedsToMove(): boolean {\r\n return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n }\r\n\r\n /** @internal */\r\n public _updatePosition(): void {\r\n if (this.checkCollisions && this.getScene().collisionsEnabled) {\r\n this._collideWithWorld(this.cameraDirection);\r\n } else {\r\n super._updatePosition();\r\n }\r\n }\r\n\r\n /**\r\n * Destroy the camera and release the current resources hold by it.\r\n */\r\n public dispose(): void {\r\n this.inputs.clear();\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Gets the current object class name.\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"FreeCamera\";\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"freeCamera.js","sourceRoot":"","sources":["../../../../dev/core/src/Cameras/freeCamera.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAItC;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,YAAY;IAkCxC;;;OAGG;IACH,IAAW,kBAAkB;QACzB,MAAM,KAAK,GAAyB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClE,IAAI,KAAK,EAAE;YACP,OAAO,KAAK,CAAC,kBAAkB,CAAC;SACnC;QAED,OAAO,CAAC,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,IAAW,kBAAkB,CAAC,KAAa;QACvC,MAAM,KAAK,GAAyB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClE,IAAI,KAAK,EAAE;YACP,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC;SACpC;IACL,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,MAAM,QAAQ,GAAgC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC/E,IAAI,QAAQ,EAAE;YACV,OAAO,QAAQ,CAAC,MAAM,CAAC;SAC1B;QAED,OAAO,EAAE,CAAC;IACd,CAAC;IAED,IAAW,MAAM,CAAC,KA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AAE;mDACyB;AAMvC;IADN,SAAS,EAAE;mDACmB;AAMxB;IADN,SAAS,EAAE;gDACgB","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { serializeAsVector3, serialize } from \"../Misc/decorators\";\r\nimport { Vector3, Vector2 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { TargetCamera } from \"./targetCamera\";\r\nimport { FreeCameraInputsManager } from \"./freeCameraInputsManager\";\r\nimport type { FreeCameraMouseInput } from \"../Cameras/Inputs/freeCameraMouseInput\";\r\nimport type { FreeCameraKeyboardMoveInput } from \"../Cameras/Inputs/freeCameraKeyboardMoveInput\";\r\nimport { Tools } from \"../Misc/tools\";\r\n\r\nimport type { Collider } from \"../Collisions/collider\";\r\n\r\n/**\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like the gamepad.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#universal-camera\r\n */\r\nexport class FreeCamera extends TargetCamera {\r\n /**\r\n * Define the collision ellipsoid of the camera.\r\n * This is helpful to simulate a camera body like the player body around the camera\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions#arcrotatecamera\r\n */\r\n @serializeAsVector3()\r\n public ellipsoid = new Vector3(0.5, 1, 0.5);\r\n\r\n /**\r\n * Define an offset for the position of the ellipsoid around the camera.\r\n * This can be helpful to determine the center of the body near the gravity center of the body\r\n * instead of its head.\r\n */\r\n @serializeAsVector3()\r\n public ellipsoidOffset = new Vector3(0, 0, 0);\r\n\r\n /**\r\n * Enable or disable collisions of the camera with the rest of the scene objects.\r\n */\r\n @serialize()\r\n public checkCollisions = false;\r\n\r\n /**\r\n * Enable or disable gravity on the camera.\r\n */\r\n @serialize()\r\n public applyGravity = false;\r\n\r\n /**\r\n * Define the input manager associated to the camera.\r\n */\r\n public inputs: FreeCameraInputsManager;\r\n\r\n /**\r\n * Gets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n public get angularSensibility(): number {\r\n const mouse = <FreeCameraMouseInput>this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n return mouse.angularSensibility;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Sets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n public set angularSensibility(value: number) {\r\n const mouse = <FreeCameraMouseInput>this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n mouse.angularSensibility = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\r\n */\r\n public get keysUp(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysUp(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the upward move of the camera.\r\n */\r\n public get keysUpward(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUpward;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysUpward(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUpward = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\r\n */\r\n public get keysDown(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysDown(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the downward move of the camera.\r\n */\r\n public get keysDownward(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDownward;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysDownward(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDownward = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n public get keysLeft(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysLeft(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n public get keysRight(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysRight(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left rotation move of the camera.\r\n */\r\n public get keysRotateLeft(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRotateLeft;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysRotateLeft(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRotateLeft = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right rotation move of the camera.\r\n */\r\n public get keysRotateRight(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRotateRight;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysRotateRight(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRotateRight = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the up rotation move of the camera.\r\n */\r\n public get keysRotateUp(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRotateUp;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysRotateUp(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRotateUp = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the down rotation move of the camera.\r\n */\r\n public get keysRotateDown(): number[] {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRotateDown;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public set keysRotateDown(value: number[]) {\r\n const keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRotateDown = value;\r\n }\r\n }\r\n\r\n /**\r\n * Event raised when the camera collide with a mesh in the scene.\r\n */\r\n public onCollide: (collidedMesh: AbstractMesh) => void;\r\n\r\n private _collider: Collider;\r\n private _needMoveForGravity = false;\r\n private _oldPosition = Vector3.Zero();\r\n private _diffPosition = Vector3.Zero();\r\n private _newPosition = Vector3.Zero();\r\n\r\n /** @internal */\r\n public _localDirection: Vector3;\r\n /** @internal */\r\n public _transformedDirection: Vector3;\r\n\r\n /**\r\n * Instantiates a Free Camera.\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like touch to this camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines whether the camera should be marked as active if not other active cameras have been defined\r\n */\r\n constructor(name: string, position: Vector3, scene?: Scene, setActiveOnSceneIfNoneActive = true) {\r\n super(name, position, scene, setActiveOnSceneIfNoneActive);\r\n this.inputs = new FreeCameraInputsManager(this);\r\n this.inputs.addKeyboard().addMouse();\r\n }\r\n\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n public attachControl(noPreventDefault?: boolean): void;\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param ignored defines an ignored parameter kept for backward compatibility.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n * BACK COMPAT SIGNATURE ONLY.\r\n */\r\n public attachControl(ignored: any, noPreventDefault?: boolean): void;\r\n /**\r\n * Attached controls to the current camera.\r\n * @param ignored defines an ignored parameter kept for backward compatibility.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n public attachControl(ignored?: any, noPreventDefault?: boolean): void {\r\n // eslint-disable-next-line prefer-rest-params\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n this.inputs.attachElement(noPreventDefault);\r\n }\r\n\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n */\r\n public detachControl(): void {\r\n this.inputs.detachElement();\r\n\r\n this.cameraDirection = new Vector3(0, 0, 0);\r\n this.cameraRotation = new Vector2(0, 0);\r\n }\r\n\r\n // Collisions\r\n private _collisionMask = -1;\r\n\r\n /**\r\n * Define a collision mask to limit the list of object the camera can collide with\r\n */\r\n public get collisionMask(): number {\r\n return this._collisionMask;\r\n }\r\n\r\n public set collisionMask(mask: number) {\r\n this._collisionMask = !isNaN(mask) ? mask : -1;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _collideWithWorld(displacement: Vector3): void {\r\n let globalPosition: Vector3;\r\n\r\n if (this.parent) {\r\n globalPosition = Vector3.TransformCoordinates(this.position, this.parent.getWorldMatrix());\r\n } else {\r\n globalPosition = this.position;\r\n }\r\n\r\n globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);\r\n this._oldPosition.addInPlace(this.ellipsoidOffset);\r\n\r\n const coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n\r\n this._collider._radius = this.ellipsoid;\r\n this._collider.collisionMask = this._collisionMask;\r\n\r\n //no need for clone, as long as gravity is not on.\r\n let actualDisplacement = displacement;\r\n\r\n //add gravity to the direction to prevent the dual-collision checking\r\n if (this.applyGravity) {\r\n //this prevents mending with cameraDirection, a global variable of the free camera class.\r\n actualDisplacement = displacement.add(this.getScene().gravity);\r\n }\r\n\r\n coordinator.getNewPosition(this._oldPosition, actualDisplacement, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n }\r\n\r\n private _onCollisionPositionChange = (collisionId: number, newPosition: Vector3, collidedMesh: Nullable<AbstractMesh> = null) => {\r\n this._newPosition.copyFrom(newPosition);\r\n\r\n this._newPosition.subtractToRef(this._oldPosition, this._diffPosition);\r\n\r\n if (this._diffPosition.length() > Engine.CollisionsEpsilon) {\r\n this.position.addToRef(this._diffPosition, this._deferredPositionUpdate);\r\n if (!this._deferOnly) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n } else {\r\n this._deferredUpdated = true;\r\n }\r\n // call onCollide, if defined. Note that in case of deferred update, the actual position change might happen in the next frame.\r\n if (this.onCollide && collidedMesh) {\r\n this.onCollide(collidedMesh);\r\n }\r\n }\r\n };\r\n\r\n /** @internal */\r\n public _checkInputs(): void {\r\n if (!this._localDirection) {\r\n this._localDirection = Vector3.Zero();\r\n this._transformedDirection = Vector3.Zero();\r\n }\r\n\r\n this.inputs.checkInputs();\r\n\r\n super._checkInputs();\r\n }\r\n\r\n /**\r\n * Enable movement without a user input. This allows gravity to always be applied.\r\n */\r\n public set needMoveForGravity(value: boolean) {\r\n this._needMoveForGravity = value;\r\n }\r\n\r\n /**\r\n * When true, gravity is applied whether there is user input or not.\r\n */\r\n public get needMoveForGravity(): boolean {\r\n return this._needMoveForGravity;\r\n }\r\n\r\n /** @internal */\r\n public _decideIfNeedsToMove(): boolean {\r\n return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n }\r\n\r\n /** @internal */\r\n public _updatePosition(): void {\r\n if (this.checkCollisions && this.getScene().collisionsEnabled) {\r\n this._collideWithWorld(this.cameraDirection);\r\n } else {\r\n super._updatePosition();\r\n }\r\n }\r\n\r\n /**\r\n * Destroy the camera and release the current resources hold by it.\r\n */\r\n public dispose(): void {\r\n this.inputs.clear();\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Gets the current object class name.\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"FreeCamera\";\r\n }\r\n}\r\n"]}
|
package/Cameras/targetCamera.js
CHANGED
|
@@ -265,7 +265,7 @@ export class TargetCamera extends Camera {
|
|
|
265
265
|
}
|
|
266
266
|
this._deferredPositionUpdate.addInPlace(this.cameraDirection);
|
|
267
267
|
if (!this._deferOnly) {
|
|
268
|
-
this.position.copyFrom(this.
|
|
268
|
+
this.position.copyFrom(this._deferredPositionUpdate);
|
|
269
269
|
}
|
|
270
270
|
else {
|
|
271
271
|
this._deferredUpdated = true;
|