Scene Class

Extends Scene
Module: Core

Scenes allow you to set up what and where is to be rendered by three.js. This is where you place objects, lights and cameras.

Scene original documentation available here https://threejs.org/docs/index.html#Reference/Scenes/Scene.

Constructor

Scene

()

Methods

addCamera

(
  • camera
)

Add camera to active cameras list.

Parameters:

  • camera Camera

getCamera

(
  • uuid
)
Camera

Get camera from scene using cameras uuid.

Parameters:

  • uuid String

    UUID of the camera

Returns:

Camera:

Camera if found, else null

initialize

()

Initialize scene objects.

Called automatically by the runtime.

removeCamera

(
  • camera
)

Remove camera from active camera list.

Parameters:

  • camera Camera

    Camera to be removed

setFogMode

(
  • mode
)

Set scene fog mode.

Parameters:

  • mode Number

toJSON

(
  • meta
)
Object

Serialize scene as JSON.

Also serializes physics world information.

Parameters:

  • meta Object

Returns:

Object:

json

update

()

Update scene objects and the physics world.

Called automatically by the runtime.

updateCameraOrder

()

Update active cameras order.

Properties

canvas

DOM

Canvas used to draw this scene.

mouse

Vector2

Normalized mouse coordinates used by the scene internal raycaster.

program

Program

Program that contains this scene.

raycaster

Raycaster

Raycaster used for mouse interaction with 3D objects. This raycaster is automatically updated using the first camera being drawn.

world

World

Cannon.js world used for physics simulation. The world is configured by default with a NaiveBroadphase and a SplitSolver. Documentation for cannon.js physics World object can be found here http://schteppe.github.io/cannon.js/docs/classes/World.html.