ObjectUtils Class

Module: Utils

Object utils is a collection of methods to apply operations to Object3D instances.

Methods

calculateBoudingBox

(
  • object
)
THREE.Box3

Calculates a bouding box for an object considering all its children.

Includes booth the object and all of its children, the box is ajusted to world space coordinates.

Parameters:

  • object THREE.Object3D

    Root object to be traversed.

Returns:

THREE.Box3:

Bouding box of the object considering all of its children.

centerGeometryOrigin

(
  • object
)

Recalculate all children origins, to be centered with their geometry.

Parameters:

  • object Object3D

    Object to recalculate origin of.

centerUnitary

(
  • object
)

Scale and center object into a unitary box.

Useful to scale objects to fit into a known size box.

Parameters:

  • object Object3D

    Object to be positioned and scaled.

convertToBufferGeometry

(
  • object
)

Covert all the geometries found in the object to BufferGeometry format.

Parameters:

  • object Object3D

    Object to search for geometries

getRoot

(
  • obj
)
Object3D

Get object tree root by traversing the tree upwards.

For a object placed inside a running scene the root is always the program.

Parameters:

Returns:

Object3D:

root