nape-js API
    Preparing search index...

    Class Circle

    A circular physics shape. The simplest and most performant collision shape.

    Hierarchy (View Summary)

    Index

    Constructors

    • Create a circle with the given radius and optional local centre-of-mass offset.

      Parameters

      • radius: number = 50

        Circle radius (must be > 0).

      • OptionallocalCOM: Vec2

        Local centre offset (defaults to origin).

      • Optionalmaterial: Material

        Material to assign (uses default if omitted).

      • Optionalfilter: InteractionFilter

        InteractionFilter to assign (uses default if omitted).

      Returns Circle

    Accessors

    Methods

    • Return true if the given world-space point lies inside this shape. Requires the shape to be attached to a Body.

      Parameters

      • point: Vec2

        The world-space point to test.

      Returns boolean

      True if the point is inside this shape.

    • Scale the shape's local geometry. Circles require uniform scaling.

      Parameters

      • scaleX: number

        Horizontal scale factor (must be non-zero).

      • scaleY: number

        Vertical scale factor (must be non-zero).

      Returns Shape

      this for chaining.

    • Apply a Mat23 affine transform to the shape's local geometry.

      Parameters

      • matrix: { _inner: any }

        The transformation matrix (must be non-singular; Circles require equiorthogonal).

      Returns Shape

      this for chaining.