ObjectUtils Class

Module: Utils

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

Methods

calculateBoundingBox

(
  • object
)
Box3

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

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

Parameters:

  • object Object3D

    Root object to be traversed.

Returns:

Box3:

Bounding 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