nape-js API
    Preparing search index...

    Class Vec3

    3D vector used for constraint impulses and other 3-component values.

    Supports object pooling via Vec3.get() / dispose().

    Converted from nape-compiled.js lines 24120–25040.

    Index

    Constructors

    Accessors

    Methods

    Constructors

    • Create a Vec3 with the given components. Defaults to (0, 0, 0).

      Parameters

      • x: number = 0

        The x component.

      • y: number = 0

        The y component.

      • z: number = 0

        The z component.

      Returns Vec3

    Accessors

    Methods

    • Check whether this Vec3 is component-wise equal to another, within an optional epsilon tolerance.

      Parameters

      • other: Vec3

        The Vec3 to compare against.

      • epsilon: number = 0

        Maximum allowed difference per component (default 0).

      Returns boolean

      true if all three components differ by at most epsilon.

    • Set all three components at once in-place.

      Parameters

      • x: number

        The new x component.

      • y: number

        The new y component.

      • z: number

        The new z component.

      Returns this

      this for chaining.

    • Return the x and y components as a new Vec2.

      Parameters

      • weak: boolean = false

        If true, the returned Vec2 is a weak (pooled) reference.

      Returns Vec2

      A new Vec2 containing this vector's x and y components.

    • Allocate a Vec3 from the public object pool, or create a new one if the pool is empty.

      Parameters

      • x: number = 0

        Initial x component (default 0).

      • y: number = 0

        Initial y component (default 0).

      • z: number = 0

        Initial z component (default 0).

      Returns Vec3

      A Vec3 initialised with the given components.