Capítulo 593 de 859

Chapter 593: SelectionBox

Core Idea

This class can be used to select 3D objects in a scene with a selection box. It is recommended to visualize the selected area with the help of SelectionHelper.

Key Concepts

  • batches : Object: The selected batches of batched meshes.
  • camera : Camera: The camera the scene is rendered with.
  • collection : Array.<Object3D>: The selected 3D objects.
  • deep : number: How deep the selection frustum of perspective cameras should extend.
  • endPoint : Vector3: The end point of the selection.
  • instances : Object: The selected instance IDs of instanced meshes.
  • scene : Scene: The camera the scene is rendered with.
  • startPoint : Vector3: The start point of the selection.

Code Examples

const selectionBox = new SelectionBox( camera, scene );
const selectedObjects = selectionBox.select( startPoint, endPoint );
  • What it demonstrates: Typical usage of SelectionBox.

Reference Tables

Constructor

Signature
new SelectionBox( camera : Camera, scene : Scene, deep : number )

Properties

PropertyDescription
.batches : ObjectThe selected batches of batched meshes.
.camera : CameraThe camera the scene is rendered with.
.collection : Array.<Object3D>The selected 3D objects.
.deep : numberHow deep the selection frustum of perspective cameras should extend.
.endPoint : Vector3The end point of the selection.
.instances : ObjectThe selected instance IDs of instanced meshes.
.scene : SceneThe camera the scene is rendered with.
.startPoint : Vector3The start point of the selection.

Methods

MethodDescription
.select( startPoint : Vector3, endPoint : Vector3 ) : Array.<Object3D>This method selects 3D objects in the scene based on the given start and end point. If no parameters are provided, the method uses the start and end values of the respective members.

Key Takeaways

  1. Most relevant properties: batches, camera, collection, deep.
  2. Key methods: select.

Connects To