PhotoDome

Display a 360 degree photo on an approximately spherical surface, useful for VR applications or skyboxes. As a subclass of TransformNode, this allow parenting to the camera with different locations in the scene. This class achieves its effect with a Texture and a correctly configured BackgroundMaterial on an inverted sphere. Potential additions to this helper include zoom and and non-infinite distance rendering effects.

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Find examples in Playground
  • new PhotoDome(name: string, urlOfPhoto: string, options: object, scene: Scene, onError?: Nullable<function>): PhotoDome
  • Create an instance of this class and pass through the parameters to the relevant classes, Texture, StandardMaterial, and Mesh.

    Parameters

    • name: string

      Element's name, child elements will append suffixes for their own names.

    • urlOfPhoto: string
    • options: object

      defines an object containing optional or exposed sub element properties

      • Optional resolution?: number
      • Optional size?: number
      • Optional useDirectMapping?: boolean
    • scene: Scene
    • Optional onError: Nullable<function>

      defines a callback called when an error occured while loading the texture

    Returns PhotoDome

Properties

absolutePosition

Find examples in Playground
absolutePosition: Vector3

Returns the current mesh absolute position. Returns a Vector3.

animationPropertiesOverride

Find examples in Playground
animationPropertiesOverride: Nullable<AnimationPropertiesOverride>

Gets or sets the animation properties override

animations

Find examples in Playground
animations: Animation[]

Gets a list of Animations associated with the node

behaviors

Find examples in Playground
behaviors: Behavior<Node>[]

Gets the list of attached behaviors

see

http://doc.babylonjs.com/features/behaviour

billboardMode

Find examples in Playground
billboardMode: number

Set the billboard mode. Default is 0.

Value Type Description
0 BILLBOARDMODE_NONE
1 BILLBOARDMODE_X
2 BILLBOARDMODE_Y
4 BILLBOARDMODE_Z
7 BILLBOARDMODE_ALL

doNotSerialize

Find examples in Playground
doNotSerialize: boolean

Gets or sets a boolean used to define if the node must be serialized

forward

Find examples in Playground
forward: Vector3

The forward direction of that transform in world space.

fovMultiplier

Find examples in Playground
fovMultiplier: number

The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values "zoom in" and higher values "zoom out". Also see the options.resolution property.

id

Find examples in Playground
id: string

Gets or sets the id of the node

ignoreNonUniformScaling

Find examples in Playground
ignoreNonUniformScaling: boolean

Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored. By default the system will update normals to compensate

infiniteDistance

Find examples in Playground
infiniteDistance: boolean

Sets the distance of the object to max, often used by skybox

isWorldMatrixFrozen

Find examples in Playground
isWorldMatrixFrozen: boolean

True if the World matrix has been frozen.

metadata

Find examples in Playground
metadata: any

Gets or sets an object used to store user defined information for the node

name

Find examples in Playground
name: string

Gets or sets the name of the node

nonUniformScaling

Find examples in Playground
nonUniformScaling: boolean

True if the scaling property of this object is non uniform eg. (1,2,1)

onAfterWorldMatrixUpdateObservable

Find examples in Playground
onAfterWorldMatrixUpdateObservable: Observable<TransformNode>

An event triggered after the world matrix is updated

onDispose

Find examples in Playground
onDispose: function

Sets a callback that will be raised when the node will be disposed

Type declaration

    • (): void
    • Returns void

onDisposeObservable

Find examples in Playground
onDisposeObservable: Observable<Node>

An event triggered when the mesh is disposed

onLoadErrorObservable

Find examples in Playground
onLoadErrorObservable: Observable<string>

Observable raised when an error occured while loading the 360 image

onReady

Find examples in Playground
onReady: function

Callback raised when the node is ready to be used

Type declaration

    • (node: Node): void
    • Parameters

      Returns void

parent

Find examples in Playground
parent: Nullable<Node>

Gets or sets the parent of the node

photoTexture

Find examples in Playground
photoTexture: Texture

Gets or sets the texture being displayed on the sphere

position

Find examples in Playground
position: Vector3

Gets or set the node position (default is (0.0, 0.0, 0.0))

reservedDataStore

Find examples in Playground
reservedDataStore: any

For internal use only. Please do not use.

right

Find examples in Playground
right: Vector3

The right direction of that transform in world space.

rotation

Find examples in Playground
rotation: Vector3

Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)). If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion

rotationQuaternion

Find examples in Playground
rotationQuaternion: Nullable<Quaternion>

Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (null by default). If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)

scaling

Find examples in Playground
scaling: Vector3

Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).

scalingDeterminant

Find examples in Playground
scalingDeterminant: number

Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube

state

Find examples in Playground
state: string

Gets or sets a string used to store user defined state for the node

uniqueId

Find examples in Playground
uniqueId: number

Gets or sets the unique id of the node

up

Find examples in Playground

The up direction of that transform in world space.

worldMatrixFromCache

Find examples in Playground
worldMatrixFromCache: Matrix

Returns directly the latest state of the mesh World matrix. A Matrix is returned.

Static BILLBOARDMODE_ALL

Find examples in Playground
BILLBOARDMODE_ALL: number

Object will rotate to face the camera

Static BILLBOARDMODE_NONE

Find examples in Playground
BILLBOARDMODE_NONE: number

Object will not rotate to face the camera

Static BILLBOARDMODE_X

Find examples in Playground
BILLBOARDMODE_X: number

Object will rotate to face the camera but only on the x axis

Static BILLBOARDMODE_Y

Find examples in Playground
BILLBOARDMODE_Y: number

Object will rotate to face the camera but only on the y axis

Static BILLBOARDMODE_Z

Find examples in Playground
BILLBOARDMODE_Z: number

Object will rotate to face the camera but only on the z axis

Methods

addBehavior

Find examples in Playground

addRotation

Find examples in Playground
  • Adds a rotation step to the mesh current rotation. x, y, z are Euler angles expressed in radians. This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set. This means this rotation is made in the mesh local space only. It's useful to set a custom rotation order different from the BJS standard one YXZ. Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.

    mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);

    Note that addRotation() accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values. Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.

    Parameters

    • x: number

      Rotation to add

    • y: number

      Rotation to add

    • z: number

      Rotation to add

    Returns TransformNode

    the TransformNode.

attachToBone

Find examples in Playground
  • Attach the current TransformNode to another TransformNode associated with a bone

    Parameters

    • bone: Bone

      Bone affecting the TransformNode

    • affectedTransformNode: TransformNode

      TransformNode associated with the bone

    Returns TransformNode

    this object

beginAnimation

Find examples in Playground
  • beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: function): Nullable<Animatable>
  • Will start the animation sequence

    Parameters

    • name: string

      defines the range frames for animation sequence

    • Optional loop: boolean

      defines if the animation should loop (false by default)

    • Optional speedRatio: number

      defines the speed factor in which to run the animation (1 by default)

    • Optional onAnimationEnd: function

      defines a function to be executed when the animation ended (undefined by default)

        • (): void
        • Returns void

    Returns Nullable<Animatable>

    the object created for this animation. If range does not exist, it will return null

clone

Find examples in Playground
  • Clone the current transform node

    Parameters

    • name: string

      Name of the new clone

    • newParent: Node

      New parent for the clone

    • Optional doNotCloneChildren: boolean

      Do not clone children hierarchy

    Returns Nullable<TransformNode>

    the new transform node

computeWorldMatrix

Find examples in Playground
  • computeWorldMatrix(force?: boolean): Matrix

createAnimationRange

Find examples in Playground
  • createAnimationRange(name: string, from: number, to: number): void
  • Creates an animation range for this node

    Parameters

    • name: string

      defines the name of the range

    • from: number

      defines the starting key

    • to: number

      defines the end key

    Returns void

deleteAnimationRange

Find examples in Playground
  • deleteAnimationRange(name: string, deleteFrames?: boolean): void
  • Delete a specific animation range

    Parameters

    • name: string

      defines the name of the range to delete

    • Optional deleteFrames: boolean

      defines if animation frames from the range must be deleted as well

    Returns void

detachFromBone

Find examples in Playground

dispose

Find examples in Playground
  • dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void
  • Releases resources associated with this node.

    Parameters

    • Optional doNotRecurse: boolean

      Set to true to not recurse into each children (recurse into each children by default)

    • Optional disposeMaterialAndTextures: boolean

      Set to true to also dispose referenced materials and textures (false by default)

    Returns void

freezeWorldMatrix

Find examples in Playground

getAbsolutePivotPoint

Find examples in Playground

getAbsolutePivotPointToRef

Find examples in Playground

getAbsolutePosition

Find examples in Playground

getAnimationByName

Find examples in Playground
  • Get an animation by name

    Parameters

    • name: string

      defines the name of the animation to look for

    Returns Nullable<Animation>

    null if not found else the requested animation

getAnimationRange

Find examples in Playground
  • Get an animation range by name

    Parameters

    • name: string

      defines the name of the animation range to look for

    Returns Nullable<AnimationRange>

    null if not found else the requested animation range

getBehaviorByName

Find examples in Playground

getChildMeshes

Find examples in Playground
  • getChildMeshes(directDescendantsOnly?: boolean, predicate?: function): AbstractMesh[]
  • Get all child-meshes of this node

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: function

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    Returns AbstractMesh[]

    an array of AbstractMesh

getChildTransformNodes

Find examples in Playground
  • getChildTransformNodes(directDescendantsOnly?: boolean, predicate?: function): TransformNode[]
  • Get all child-transformNodes of this node

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: function

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    Returns TransformNode[]

    an array of TransformNode

getChildren

Find examples in Playground
  • getChildren(predicate?: function, directDescendantsOnly?: boolean): Node[]
  • Get all direct children of this node

    Parameters

    • Optional predicate: function

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)

    Returns Node[]

    an array of Node

getClassName

Find examples in Playground
  • getClassName(): string

getDescendants

Find examples in Playground
  • getDescendants(directDescendantsOnly?: boolean, predicate?: function): Node[]
  • Will return all nodes that have this node as ascendant

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: function

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    Returns Node[]

    all children nodes of all types

getDirection

Find examples in Playground
  • Returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh. This Vector3 is expressed in the World space.

    Parameters

    • localAxis: Vector3

      axis to rotate

    Returns Vector3

    a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.

getDirectionToRef

Find examples in Playground
  • Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh. localAxis is expressed in the mesh local space. result is computed in the Wordl space from the mesh World matrix.

    Parameters

    • localAxis: Vector3

      axis to rotate

    • result: Vector3

      the resulting transformnode

    Returns TransformNode

    this TransformNode.

getDistanceToCamera

Find examples in Playground

getEngine

Find examples in Playground

getPivotMatrix

Find examples in Playground

getPivotPoint

Find examples in Playground

getPivotPointToRef

Find examples in Playground

getPoseMatrix

Find examples in Playground

getPositionExpressedInLocalSpace

Find examples in Playground
  • getPositionExpressedInLocalSpace(): Vector3

getPositionInCameraSpace

Find examples in Playground

getScene

Find examples in Playground

getWorldMatrix

Find examples in Playground

isDescendantOf

Find examples in Playground
  • isDescendantOf(ancestor: Node): boolean
  • Is this node a descendant of the given node? The function will iterate up the hierarchy until the ancestor was found or no more parents defined

    Parameters

    • ancestor: Node

      defines the parent node to inspect

    Returns boolean

    a boolean indicating if this node is a descendant of the given node

isDisposed

Find examples in Playground
  • isDisposed(): boolean
  • Gets a boolean indicating if the node has been disposed

    Returns boolean

    true if the node was disposed

isEnabled

Find examples in Playground
  • isEnabled(checkAncestors?: boolean): boolean
  • Is this node enabled? If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true

    Parameters

    • Optional checkAncestors: boolean

      indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors

    Returns boolean

    whether this node (and its parent) is enabled

isReady

Find examples in Playground
  • isReady(completeCheck?: boolean): boolean
  • Is this node ready to be used/rendered

    Parameters

    • Optional completeCheck: boolean

      defines if a complete check (including materials and lights) has to be done (false by default)

    Returns boolean

    true if the node is ready

locallyTranslate

Find examples in Playground

lookAt

Find examples in Playground
  • Orients a mesh towards a target point. Mesh must be drawn facing user.

    Parameters

    • targetPoint: Vector3

      the position (must be in same space as current mesh) to look at

    • Optional yawCor: number

      optional yaw (y-axis) correction in radians

    • Optional pitchCor: number

      optional pitch (x-axis) correction in radians

    • Optional rollCor: number

      optional roll (z-axis) correction in radians

    • Optional space: Space

      the choosen space of the target

    Returns TransformNode

    the TransformNode.

markAsDirty

Find examples in Playground
  • Flag the transform node as dirty (Forcing it to update everything)

    Parameters

    • property: string

      if set to "rotation" the objects rotationQuaternion will be set to null

    Returns TransformNode

    this transform node

registerAfterWorldMatrixUpdate

Find examples in Playground

removeBehavior

Find examples in Playground

rotate

Find examples in Playground
  • Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space. space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD. Note that the property rotationQuaternion is then automatically updated and the property rotation is set to (0,0,0) and no longer used. The passed axis is also normalized.

    Parameters

    • axis: Vector3

      the axis to rotate around

    • amount: number

      the amount to rotate in radians

    • Optional space: Space

      Space to rotate in (Default: local)

    Returns TransformNode

    the TransformNode.

rotateAround

Find examples in Playground

serialize

Find examples in Playground
  • serialize(currentSerializationObject?: any): any
  • Serializes the objects information.

    Parameters

    • Optional currentSerializationObject: any

      defines the object to serialize in

    Returns any

    the serialized object

serializeAnimationRanges

Find examples in Playground
  • serializeAnimationRanges(): any

setAbsolutePosition

Find examples in Playground

setDirection

Find examples in Playground
  • setDirection(localAxis: Vector3, yawCor?: number, pitchCor?: number, rollCor?: number): TransformNode
  • Sets this transform node rotation to the given local axis.

    Parameters

    • localAxis: Vector3

      the axis in local space

    • Optional yawCor: number

      optional yaw (y-axis) correction in radians

    • Optional pitchCor: number

      optional pitch (x-axis) correction in radians

    • Optional rollCor: number

      optional roll (z-axis) correction in radians

    Returns TransformNode

    this TransformNode

setEnabled

Find examples in Playground
  • setEnabled(value: boolean): void
  • Set the enabled state of this node

    Parameters

    • value: boolean

      defines the new enabled state

    Returns void

setParent

Find examples in Playground
  • Defines the passed node as the parent of the current node. The node will remain exactly where it is and its position / rotation will be updated accordingly

    Parameters

    Returns TransformNode

    this TransformNode.

setPivotMatrix

Find examples in Playground
  • Sets a new pivot matrix to the current node

    Parameters

    • matrix: DeepImmutable<Matrix>

      defines the new pivot matrix to use

    • Optional postMultiplyPivotMatrix: boolean

      defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect

    Returns TransformNode

    the current TransformNode

setPivotPoint

Find examples in Playground
  • Sets a new pivot point to the current node

    Parameters

    • point: Vector3

      defines the new pivot point to use

    • Optional space: Space

      defines if the point is in world or local space (local by default)

    Returns TransformNode

    the current TransformNode

setPositionWithLocalVector

Find examples in Playground

setPreTransformMatrix

Find examples in Playground

translate

Find examples in Playground
  • Translates the mesh along the axis vector for the passed distance in the given space. space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.

    Parameters

    • axis: Vector3

      the axis to translate in

    • distance: number

      the distance to translate

    • Optional space: Space

      Space to rotate in (Default: local)

    Returns TransformNode

    the TransformNode.

unfreezeWorldMatrix

Find examples in Playground
  • unfreezeWorldMatrix(): this

unregisterAfterWorldMatrixUpdate

Find examples in Playground
  • unregisterAfterWorldMatrixUpdate(func: function): TransformNode

updatePoseMatrix

Find examples in Playground

Static AddNodeConstructor

Find examples in Playground
  • Add a new node constructor

    Parameters

    • type: string

      defines the type name of the node to construct

    • constructorFunc: NodeConstructor

      defines the constructor function

    Returns void

Static Construct

Find examples in Playground
  • Construct(type: string, name: string, scene: Scene, options?: any): Nullable<function>
  • Returns a node constructor based on type name

    Parameters

    • type: string

      defines the type name

    • name: string

      defines the new node name

    • scene: Scene

      defines the hosting scene

    • Optional options: any

      defines optional options to transmit to constructors

    Returns Nullable<function>

    the new constructor or null

Static Parse

Find examples in Playground
  • Returns a new TransformNode object parsed from the source provided.

    Parameters

    • parsedTransformNode: any

      is the source.

    • scene: Scene

      the scne the object belongs to

    • rootUrl: string

      is a string, it's the root URL to prefix the delayLoadingFile property with

    Returns TransformNode

    a new TransformNode object parsed from the source provided.

Static ParseAnimationRanges

Find examples in Playground
  • ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void
  • Parse animation range data from a serialization object and store them into a given node

    Parameters

    • node: Node

      defines where to store the animation ranges

    • parsedNode: any

      defines the serialization object to read data from

    • scene: Scene

      defines the hosting scene

    Returns void

Generated using TypeDoc