@rbxts/rbxts-volume3 - v1.0.0
    Preparing search index...

    Class Volume3

    The Volume3 class is used to represent a 3D volume in space defined by a set of vertices or tracked objects, allowing for efficient querying of Model(s) and BasePart(s) entering and leaving the volume.

    Index

    Constructors

    • Creates a new Volume3 from a list of vertices and optional ObjectTracker(s).

      Parameters

      • vertices: Vector3[]

        The list of Vector3(s) that make up the volume.

      • Optionaltrackers: ObjectTracker[]

        The optional list of ObjectTracker(s) that make up the volume.

      Returns Volume3

      The created Volume3.

    Properties

    ModelQueryMode: { All: 2; Any: 1; Primary: 3 } = ...

    Enum used to represent how a given Volume3 should query against any given Model.

    Type Declaration

    • ReadonlyAll: 2

      Any Volume3 using ModelQueryMode.All will only consider any given Model entered / inside if ALL of its descendant BasePart(s) meets the current PartQueryMode requirements.

    • ReadonlyAny: 1

      Any Volume3 using ModelQueryMode.Any will consider any given Model entered / inside if any descendant BasePart meets the current PartQueryMode requirements.

    • ReadonlyPrimary: 3

      Any Volume3 using ModelQueryMode.Primary will only consider any given Model entered / inside if its PrimaryPart meets the current PartQueryMode requirements.

    ObjectTracker: typeof ObjectTracker = ObjectTracker
    ObjectTrackerMode: { Box: 2; Point: 1 } = ...

    Enum used to represent what points an ObjectTracker should gather from its target Object.

    Type Declaration

    • ReadonlyBox: 2

      Any ObjectTracker using ObjectTrackerMode.Box will track and update using all 8 corner points of the tracked object or its bounds, taking into account rotation, and acting as a cloud of vertices for any containing Volume3(s)

    • ReadonlyPoint: 1

      Any ObjectTracker using ObjectTrackerMode.Point will only track and update using the center point of the tracked object or its bounds, effectively ignoring rotation, and acting as a single vertex for any containing Volume3(s)

    ObjectTrackerPrecision: { High: 2; Low: 1 } = ...

    Enum used to represent how a Volume3 should recalculate its bounds when an ObjectTracker it contains fires its LiveUpdate.

    Type Declaration

    • ReadonlyHigh: 2

      Any Volume3 containing an ObjectTracker using ObjectTrackerPrecision.High should recalculate its true bounds upon receiving a LiveUpdate. This is useful for when accuracy is more important than performance, or when tracked objects in the same Volume3 move or rotate independently of one another. e.g. ObjectTracker(s) are tracking objects that move each based on their own assembly or system.

    • ReadonlyLow: 1

      Any Volume3 containing an ObjectTracker using ObjectTrackerPrecision.Low should only update positions, and never recalculate its true bounds. This is useful for large numbers of trackers where performance is more important than accuracy, or when all tracked objects are guaranteed to move at the same time in the same way. e.g. all ObjectTracker(s) are tracking objects connected to the same assembly.

    PartQueryMode: { Box: 2; Point: 1 } = ...

    Enum used to represent how a given Volume3 should query against any given BasePart.

    Type Declaration

    • ReadonlyBox: 2

      Any Volume3 using PartQueryMode.Box will consider any given BasePart entered / inside if the volume overlaps or contains it in any way.

    • ReadonlyPoint: 1

      Any Volume3 using PartQueryMode.Point will only consider any given BasePart entered / inside if the volume contains the center point.

    Methods

    • Checks if the given Model or BasePart is inside this Volume3 ( warns and returns false if not aware ).

      Parameters

      • thing: Model | BasePart

        The Model or BasePart to check.

      Returns boolean

      Whether the object is inside and aware.

    • Begins listening for updates to this Volume3, attaching a query to the RunService.PostSimulation event.

      Returns void

    • Clears all awareness of objects within this Volume3.

      Returns void

    • Destroys this Volume3, disconnecting all connections and clearing all data.

      Returns void

    • Destroys this Volume3, disconnecting all connections and clearing all data, including destroying all contained ObjectTracker(s).

      Returns void

    • Gets an array of all Model or BasePart instances that this Volume3 is aware of and are inside it.

      Returns (Model | BasePart)[]

      An array of objects that are inside and aware.

    • Gets the current ModelQueryMode defining how this Volume3 queries against any given Model.

      Returns ModelQueryMode

      The current ModelQueryMode.

    • Gets the current PartQueryMode defining how this Volume3 queries against any given BasePart.

      Returns PartQueryMode

      The current PartQueryMode.

    • Checks if this Volume3 is aware of the given Model or BasePart.

      Parameters

      • thing: Model | BasePart

        The Model or BasePart to check awareness for.

      Returns boolean

      Whether this Volume3 is aware of the given object.

    • Checks if the given Model or BasePart is inside this Volume3.

      Parameters

      • thing: Model | BasePart

        The Model or BasePart to check.

      Returns boolean

      Whether the object is inside.

    • Sets the current ModelQueryMode defining how this Volume3 queries against any given Model.

      Parameters

      Returns void

    • Sets the current PartQueryMode defining how this Volume3 queries against any given BasePart.

      Parameters

      Returns void

    • Sets the visibility, creation and destruction of the debug parts for this Volume3.

      Parameters

      • visible: boolean

        Whether the debug parts should exist.

      Returns void

    • Stops listening for updates to this Volume3, disconnecting from the RunService.PostSimulation event.

      Returns void

    • Attempts to forget the given Model or BasePart, removing awareness.

      Parameters

      • thing: Model | BasePart

        The Model or BasePart to forget.

      Returns boolean

      Whether the forget was successful.

    • Attempts to make this Volume3 aware of the given Model or BasePart.

      Parameters

      • thing: Model | BasePart

        The Model or BasePart to become aware of.

      • automaticallyForget: boolean = true

        Whether to automatically forget the object when it is destroyed. Defaults to true.

      Returns boolean

      Whether the awareness was successfully added.

    • Creates a new Volume3 from an axis-aligned box defined by a position and Vector3 size.

      Parameters

      • position: Vector3

        The Vector3 defining the center position of the box.

      • size: Vector3

        The Vector3 defining the size of the box.

      Returns Volume3

      The created Volume3.

    • Creates a new Volume3 from a box defined by a CFrame and Vector3 size.

      Parameters

      • cf: CFrame

        The CFrame defining the center and rotation of the box.

      • size: Vector3

        The Vector3 defining the size of the box.

      Returns Volume3

      The created Volume3.

    • Creates a new Volume3 from a list of ObjectTracker(s).

      Parameters

      • trackers: ObjectTracker[]

        The list of ObjectTracker(s) that make up the volume.

      Returns Volume3

      The created Volume3.

    • Creates a new Volume3 from a plane defined by 4 corner vertices and a depth to extrude.

      Parameters

      • vertices: Vector3[]

        The list of 4 or more Vector3(s) that make up the corners of the plane.

      • depth: number

        The depth to extrude the plane along the Z axis.

      Returns Volume3

      The created Volume3.

    • Creates a new Volume3 from a plane defined by 4 corner vertices and a height to extrude.

      Parameters

      • vertices: Vector3[]

        The list of 4 or more Vector3(s) that make up the corners of the plane.

      • height: number

        The height to extrude the plane upwards along the Y axis.

      Returns Volume3

      The created Volume3.

    • Creates a new Volume3 from a plane defined by 4 corner vertices and a width to extrude.

      Parameters

      • vertices: Vector3[]

        The list of 4 or more Vector3(s) that make up the corners of the plane.

      • width: number

        The width to extrude the plane along the X axis.

      Returns Volume3

      The created Volume3.

    • Creates a new Volume3 from an existing Region3.

      Parameters

      • region: Region3

        The Region3 to create the volume from.

      Returns Volume3

      The created Volume3.

      • Volume3.FromBox for a more generalized and efficient method of creating a box-shaped Volume3.
      • Volume3.FromAABB for creating an axis-aligned box-shaped Volume3.
    • Creates a new Volume3 from a list of vertices.

      Parameters

      • vertices: Vector3[]

        The list of Vector3(s) that make up the volume.

      Returns Volume3

      The created Volume3.

    Events

    AnyEntered: Signal<[thing: Model | BasePart]> = ...

    The Signal that is fired upon any BasePart or Model ( that this Volume3 is aware of ) entering the volume.

    The BasePart or Model that has entered the volume.

    AnyLeft: Signal<[thing: Model | BasePart]> = ...

    The Signal that is fired upon any BasePart or Model ( that this Volume3 is aware of ) leaving the volume.

    The BasePart or Model that has left the volume.

    ModelEntered: Signal<[thing: Model]> = ...

    The Signal that is fired upon any Model ( that this Volume3 is aware of ) entering the volume.

    The Model that has entered the volume.

    ModelLeft: Signal<[thing: Model]> = ...

    The Signal that is fired upon any Model ( that this Volume3 is aware of ) leaving the volume.

    The Model that has left the volume.

    PartEntered: Signal<[thing: BasePart]> = ...

    The Signal that is fired upon any BasePart ( that this Volume3 is aware of ) entering the volume.

    The BasePart that has entered the volume.

    PartLeft: Signal<[thing: BasePart]> = ...

    The Signal that is fired upon any BasePart ( that this Volume3 is aware of ) leaving the volume.

    The BasePart that has left the volume.