The Compound Block Volume is a collection of individual block volume definitions which, as a collection, define a larger volume of (sometimes non-contiguous) irregular shapes. This class is loosely based on the concept of CSG (Computational Solid Geometry) and allows a user to create complex volumes by building a stack of volumes and voids to make a larger single volume. For example - normally a creator would create a hollow cube by creating 6 "wall" surfaces for each face. With a Compound Block Volume, a creator can define a hollow cube by creating a single outer solid cube, and then defining a further single 'void' cube inside the larger one. Similarly, the Compound Block Volume can represent irregular shaped volumes (e.g. a tree consists of a trunk and lots of leaf cubes which are not necessarily contiguously placed). Each of the volumes added to the CompoundBlockVolume are (by default) relative to the origin set (either at construction or via one of the set functions). However, it is also possible to push volumes to the compound collection which are absolute in nature and are not affected by origin changes.

Constructors

Properties

capacity: number

Return the 'capacity' of the bounding rectangle which represents the collection of volumes in the stack

itemsAbsolute: CompoundBlockVolumeItem[]
volumeCount: number

Return the number of volumes (positive and negative) in the volume stack

Methods

  • Beta

    Parameters

    • position: Vector3
    • OptionalpreserveExistingVolumes: boolean

      This optional boolean flag determines whether the relative CompoundBlockVolumeItem's are frozen in place, or are affected by the new origin. Imagine a scenario where you have a series of relative locations around an origin which make up a sphere; all of these locations are in the range of -2 to 2. Push each of these locations to the compound volume as relative items. Now, move the origin and all of the locations representing the sphere move accordingly. However, let's say you want to add a 2nd sphere next to the 1st. In this case, set the new origin a few locations over, but 'preserveExistingVolumes' = true. This will set a new origin, but the existing sphere locations will remain relative to the original origin. Now, you can push the relative sphere locations again (this time they will be relative to the new origin) - resulting in 2 spheres next to each other.

    Returns void

    Set the origin of the compound volume to an absolute world space location

    This function can't be called in read-only mode.