Skip to main content

PointerComponent

Add this component to optionally configure how the pointer system detects pointer events.

By default the collider shape is used and graphics bounds is not.

If both collider shape and graphics bounds are enabled it will fire events if either or are intersecting the pointer.

Hierarchy

Index

Constructors

constructor

  • Parameters

    • optionaloptions: PointerComponentOptions

    Returns PointerComponent

Properties

optionalreadonlydependencies

dependencies?: ComponentCtor<Component>[]

Optionally list any component types this component depends on If the owner entity does not have these components, new components will be added to the entity

Only components with zero-arg constructors are supported as automatic component dependencies

publicoptionallocalBounds

localBounds?: BoundingBox

Optionally use other bounds for pointer testing

optionalowner

owner?: Entity<any> = undefined

Current owning Entity, if any, of this component. Null if not added to any Entity

publicuseColliderShape

useColliderShape: boolean = true

Use any existing Collider component geometry for pointer events. This is useful if you want user pointer events only to trigger on the same collision geometry used in the collider component for collision resolution. Default is true.

publicuseGraphicsBounds

useGraphicsBounds: boolean = true

Use any existing Graphics component bounds for pointers. This is useful if you want the axis aligned bounds around the graphic to trigger pointer events. Default is true.

Methods

clone

  • Clones any properties on this component, if that property value has a clone() method it will be called


    Returns Component

optionalonAdd

  • onAdd(owner: Entity<any>): void
  • Optional callback called when a component is added to an entity


    Parameters

    Returns void

optionalonRemove

  • onRemove(previousOwner: Entity<any>): void
  • Optional callback called when a component is removed from an entity


    Parameters

    Returns void