The SceneModule
class exposes properties and methods to access the objects in a scene.
Property | Description |
---|---|
root | (get) root: Scene Returns an object that is the root of the scene tree. Other objects are accessed by walking down the scene tree from the root using the SceneObjectBase.child and SceneObjectBase.find methods. |
Method | Description |
---|---|
clone | clone(sceneObject: string | SceneObjectBase, options?: {cloneBlocksInputConnections?: false | true, cloneChildren?: false | true, initialState?: {[key: string]: any}}): Promise<SceneObjectBase> Clone a scene object asynchronously. When cloning a scene object, keep the following in mind: - sceneObject is either the identifier of the SceneObjectBase or the SceneObjectBase itself to be cloned. Cloning a scene object with an identifier that doesn't exist, or one that cannot be dynamically instantiated fails the Promise .- New objects always get assigned a globally unique identifier .- All properties that are using Signal types get assigned a ConstSignal with the last value unless initialState (see below) overrides it.- options include a set of optional parameters for cloning- cloneChildren - when true, recursively clone all children of the scene object in the scene tree. If any of the children is non-clonable or fails to be cloned, roll back to the previous state before cloning and return an error that specifies the child’s id and type. The default is false.- initialState overrides any cloned states on sceneObject .- initialState can contain any key: value pair for any settable property of the scene object class (e.g. hidden , transform ). Similar to dynamic instantiation, setting invalid fields will fail the promise.- cloneBlocksInputConnections - Block's input connections will be cloned if this flag is set to true. The default is false. The flag is ignored if sceneObject is not a BlockSceneRoot. If cloneChildren is also set to true, this flag will be recurisvely applied to all block children.Note: This API requires "Scripting Dynamic Instantiation" capability to be enabled. |
create | create(className: string, initialState?: {[key: string]: any}): Promise<SceneObjectBase> Create a scene object asynchronously. When creating the scene objects, keep the following in mind: - All objects must have an existing class. - New objects always get assigned a globally unique identifier .`- initialState is optional, but encouraged to be used.- initialState can contain any key: value pair for any settable property of the class being instantiated.- name in initialState is being used, unless it's not provided - then dynamicObject is used.) Note: This API requires "Scripting Dynamic Instantiation" capability to be enabled. |
destroy | destroy(sceneObject: string | SceneObjectBase): Promise<void> Destroy a scene object, asynchronously. When destroying scene objects, keep the following in mind: - All bound properties will be automatically unbound on destruction. - Destroying a scene object automatically removes it from any parent. - Destroying a scene object automatically removes it all children from it. - Destroying a scene object that doesn't exist fails the Promise .- Destroying a scene object that was created in Studio fails the Promise .Note: This API requires "Scripting Dynamic Instantiation" capability to be enabled. |
projectToScreen | projectToScreen(point: PointSignal): Vec2Signal Returns a signal with the value that corresponds to the 2D point value (in Screen Space) of the given world coordinate. Screen space positions are represented in the range of (0, 0) to (CameraInfo.previewSize.width, CameraInfo.previewSize.height) ,with the coordinate start being the top left point of the screen and previewSize.width/height being the bottom right.The values in the returned signal are not capped to the size of the screen space and can lie outside of the visible screen area. This functionality can be used for precisely positioning 2D screen elements or to add additional effects that apply to the entire camera texture, based on contents of the scene. |
unprojectToFocalPlane | unprojectToFocalPlane(location: Vec2Signal): PointSignal Returns a signal with the value that corresponds to the 3d point (in World Space, in current units) of the given screenSpace point from the Vec2Signal. The z coordinate of the PointSignal will be calculated so that the 3d point will always be on the canvas (which should be on the Focal Plane). This function can be combined with TouchGestures to create a 3d point signal. var S = require('Scene') |
unprojectWithDepth | unprojectWithDepth(location: Vec2Signal, depth: number): PointSignal Returns a signal with the value that corresponds to the 3d point value (in World Space, in current units) of the given screenSpace point from the Vec2Signal. The z coordinate of the PointSignal will always be equal to the given depth value. The depth should be given in current units. This function can be combined with TouchGestures to create a 3d point signal. var Scene = require('Scene') |
Class | Description |
---|---|
AmbientLightSource | The AmbientLightSource class describes an ambient lighting source. |
BlendShape | The BlendShape class describes a shape attached to a mesh or face mesh which can be used to change the shape of that mesh. |
BlockInstanceInputs | The BlockInstanceInputs class encapsulates methods for setting inputs to the block instance. |
BlockInstanceOutputs | The BlockInstanceOutputs class encapsulates methods for getting outputs of the block instance. |
BlockSceneRoot | The BlockSceneRoot class describes the root scene object of a block. |
Camera | The Camera class exposes details about the device camera focal area. |
CameraVisibility | The CameraVisibility class describes whether or not an object is visible from various camera views. |
Canvas | The Canvas class describes a scene canvas. |
DirectionalLightSource | The DirectionalLightSource class describes a directional light source. |
EnvironmentLightSource | The EnvironmentLightSource class describes an environment lighting source. |
FaceMesh | The FaceMesh class describes a face mesh. |
FaceTracker | The FaceTracker class propagates details of detected faces to the scene. |
FocalDistance | The FocalDistance class describes a focal distance in the scene.Children of FocalDistance get automatically positioned in 3D space based on the the distance between the camera image and the camera scene object itself. |
FocalPlane | The FocalPlane class exposes details about the focal plane of the device camera. |
HandTracker | This class represents the hand tracker scene object, used to track the position of hands in the scene. |
Joint | The Joint class describes a joint of a given Skeleton object. |
Mesh | The Mesh class describes a scene mesh. |
MeshSurface | The MeshSurface class describes a surface in a mesh. |
OutputVisibility | The OutputVisibility class describes whether or not an object is visible from various outputs. |
ParticleSystem | The ParticleSystem class implements the particle management system for the scene. |
ParticleTypeDescription | The ParticleTypeDescription class provides functionality for setting particle sprite densities in the scene. |
PlanarImage | The PlanarImage class describes an image rendered on a plane. |
PlanarObject | The PlanarObject class describes an object on a plane. |
PlanarStack | The PlanarStack class describes a stack of 2D Scene Elements. |
PlanarText | The PlanarText class describes text on a plane. |
Plane | The Plane class describes a plane. |
PlaneTracker | The PlaneTracker class provides functionality for locating a 3D plane based on 2D screen coordinates.When accessing the realScaleActive and realScaleSupported properties, ensure that Real World Scale is enabled in the PlaneTracker object's Inspector panel. See the Real Scale for World article for more information. |
PointLightSource | The PointLightSource class describes a point light source. |
Scene | The Scene class implements properties and methods to access the objects in a scene. |
SceneObject | The SceneObject class describes an object in a scene. |
SceneObjectBase | The base class for scene objects. |
Skeleton | The Skeleton class describes a skeleton scene object.All Joint scene object children of a given skeleton are considered part of this skeleton hierarchy. |
Speaker | The Speaker class encapsulates an speaker for a scene. Old class name is AudioSource . |
SpotLightSource | The SpotLightSource class describes a spot light source. |
SvgImage | The SvgImage class describes an SVG asset for a scene. |
TargetTracker | The TargetTracker encapsulates a tracker for some target. |
TextAlignmentWrapper | The TextAlignmentWrapper class contains text alignment details. |
TextExtrusion | "The TextExtrusion class describes a 3D text scene object. |
ThreeDObject | The ThreeDObject class describes a scene 3d object. |
Transform | The Transform class describes an object transform for a scene. |
WorldTransform | The WorldTransform class describes an object transform for a sceneObject in world space. |
Enum | Description |
---|---|
Direction | The Direction enum describes the stack layout's direction. |
HorizontalAlignment | The HorizontalAlignment enum describes how an element is aligned horizontally. |
RenderMode | |
ScalingOption | The ScalingOption enum describes how an element is scaled. |
StackAlign | The StackAlign enum describes the stack children's alignment. |
StackDistribute | The StackDistribute enum describes the stack children's distribution. |
TextAlignment | The TextAlignment enum describes how a text element is aligned horizontally. |
TrackingMode | The TrackingMode enum describes how a PlaneTracker is tracking an object. |
VerticalAlignment | The VerticalAlignment enum describes how an element is aligned vertically. |
VerticalTextAlignment | The VerticalTextAlignment enum describes how a text element is aligned vertically. |