• Studio

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • API

    Datatypes

    Edit

    Bounds

    An axis-aligned bounding box. It acts as a simple container for a center position and the extents (further subdivided into size, min, max) of a box that can be used for collision detection, visibility testing, or other similar tasks in your game.

    Properties

    Vector3 value that signifies the central point of the bounding box.

    The size of the bounding box for each dimension - how wide, tall, and deep it is.

    Similar to size but it represents half the size of the bounding box in each dimension. This can be used when you need to measure from the center of the bounding box.

    The minimum value (lower-left-front corner) of the bounding box coordinates.

    The maximal value (upper-right-back corner) of the bounding box coordinates.

    Methods

    The minimum and maximum corners of the bounding box.

    Parameters

    This specifies the smallest value for each coordinate of the bounding box.

    This represents the largest value for each coordinate of the bounding box.

    Returns

    void

    Grows the Bounds to include a point or bounds. You would typically use this when you have a set of points and you want a bounding box that encloses all these points.

    Parameters

    point
    Vector3

    The new point to include within the bounding box.

    Returns

    void

    Increases the size of the bounding box by the given amount (in both directions).

    Parameters

    amount

    number

    The amount by which the bounding box should be expanded (shrank if negative).

    Returns

    void

    Checks whether the current bounding box intersects with another bounding box. You can use this to determine if two objects are likely to be colliding.

    Parameters

    bounds
    Bounds

    The other bounding box to test intersection with.

    Returns

    boolean

    Returns true if the bounding boxes intersect, false otherwise.

    Determines if a specified Ray intersects the bounds. This can prove vital in various game scenarios for interaction detection such as determining if a projectile is in range of an object or if a click or tap in screen space intersects a game object. It evaluates the intersection and returns true if the Ray intersects with the bounds, otherwise it returns false.

    Parameters

    ray
    Ray

    The Ray instance against which the intersection is to be checked.

    Returns

    boolean

    Returns true if the Ray intersects with the bounds, otherwise false.

    Check whether a specific point is within the current bounding box.

    Parameters

    point
    Vector3

    This is the point which you want to check.

    Returns

    boolean

    Returns true if the point is inside the bounding box, false otherwise.

    Returns the squared distance from a point to the bounding box. Squared distances can be useful for comparison without needing the computationally expensive square root operation.

    Parameters

    point
    Vector3

    The point from which the distance is measured.

    Returns

    number

    Returns the squared distance from the bounding box to the point.

    The closest point on or inside the bounding box to a given point. This can be helpful in figuring out how close an object is to entering a bounding box.

    Parameters

    point
    Vector3

    This is the location from which the closest point is determined.

    Returns

    Vector3

    Returns the closest point within or on the bounding box to the given point.

    Updated 4 months ago

    PocketWorlds Icon

    © 2024 Pocket Worlds. All rights reserved.