UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

48 lines (47 loc) 1.97 kB
import { Box3, type ColorRepresentation, Object3D } from "three"; import { Behaviour } from "./Component.js"; /** * A component that creates a bounding box around an object and provides intersection testing functionality. * * Debug mode can be enabled with the URL parameter `?debugboxhelper`, which will visualize intersection tests. * Helper visualization can be enabled with the URL parameter `?gizmos`. * * @category Helpers * @group Components */ export declare class BoxHelperComponent extends Behaviour { /** The bounding box for this component */ private box; private static testBox; private _lastMatrixUpdateFrame; private static _position; private static _size; private static _emptyObjectSize; /** * Tests if an object intersects with this helper's bounding box * @param obj The object to test for intersection * @returns True if objects intersect, false if not, undefined if the provided object is invalid */ isInBox(obj: Object3D): boolean | undefined; /** * Tests if this helper's bounding box intersects with another box * @param box The {@link Box3} to test for intersection * @returns True if boxes intersect, false otherwise */ intersects(box: Box3): boolean; /** * Updates the helper's bounding box based on the gameObject's position and scale * @param force Whether to force an update regardless of frame count * @returns The updated {@link Box3} */ updateBox(force?: boolean): Box3; private _helper; private _color; awake(): void; /** * Creates and displays a visual wireframe representation of this box helper * @param col Optional color for the wireframe. If not provided, uses default color * @param force If true, shows the helper even if gizmos are disabled */ showHelper(col?: ColorRepresentation | null, force?: boolean): void; }