SpriteManager

Class used to manage multiple sprites on the same spritesheet

see

http://doc.babylonjs.com/babylon101/sprites

Hierarchy

Implements

Index

Constructors

constructor

Find examples in Playground
  • new SpriteManager(name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number, fromPacked?: boolean, spriteJSON?: any | null): SpriteManager
  • Creates a new sprite manager

    Parameters

    • name: string

      defines the manager's name

    • imgUrl: string

      defines the sprite sheet url

    • capacity: number

      defines the maximum allowed number of sprites

    • cellSize: any

      defines the size of a sprite cell

    • scene: Scene

      defines the hosting scene

    • Optional epsilon: number

      defines the epsilon value to align texture (0.01 by default)

    • Optional samplingMode: number

      defines the smapling mode to use with spritesheet

    • Optional fromPacked: boolean

      set to false; do not alter

    • Optional spriteJSON: any | null

      null otherwise a JSON object defining sprite sheet data; do not alter

    Returns SpriteManager

Properties

cellHeight

Find examples in Playground
cellHeight: number

Defines the default height of a cell in the spritesheet

cellWidth

Find examples in Playground
cellWidth: number

Defines the default width of a cell in the spritesheet

disableDepthWrite

Find examples in Playground
disableDepthWrite: boolean

Disables writing to the depth buffer when rendering the sprites. It can be handy to disable depth writing when using textures without alpha channel and setting some specific blend modes.

fogEnabled

Find examples in Playground
fogEnabled: boolean

Gets or sets a boolean indicating if the manager must consider scene fog when rendering

isPickable

Find examples in Playground
isPickable: boolean

Gets or sets a boolean indicating if the sprites are pickable

layerMask

Find examples in Playground
layerMask: number

Gets or sets camera layer mask

name

Find examples in Playground
name: string

defines the manager's name

onDisposeObservable

Find examples in Playground
onDisposeObservable: Observable<SpriteManager>

An event triggered when the manager is disposed.

renderingGroupId

Find examples in Playground
renderingGroupId: number

Gets or sets the rendering group id (0 by default)

sprites

Find examples in Playground
sprites: Sprite[]

Gets the list of sprites

Accessors

blendMode

Find examples in Playground
  • get blendMode(): number
  • set blendMode(blendMode: number): any
  • Blend mode use to render the particle, it can be any of the static Constants.ALPHA_x properties provided in this class. Default value is Constants.ALPHA_COMBINE

    Returns number

  • Blend mode use to render the particle, it can be any of the static Constants.ALPHA_x properties provided in this class. Default value is Constants.ALPHA_COMBINE

    Parameters

    • blendMode: number

    Returns any

onDispose

Find examples in Playground
  • set onDispose(callback: function): any
  • Callback called when the manager is disposed

    Parameters

    • callback: function
        • (): void
        • Returns void

    Returns any

texture

Find examples in Playground
  • Gets or sets the spritesheet texture

    Returns Texture

  • Gets or sets the spritesheet texture

    Parameters

    Returns any

Methods

dispose

Find examples in Playground
  • dispose(): void

intersects

Find examples in Playground
  • Intersects the sprites with a ray

    Parameters

    • ray: Ray

      defines the ray to intersect with

    • camera: Camera

      defines the current active camera

    • Optional predicate: function

      defines a predicate used to select candidate sprites

        • Parameters

          Returns boolean

    • Optional fastCheck: boolean

      defines if a fast check only must be done (the first potential sprite is will be used and not the closer)

    Returns Nullable<PickingInfo>

    null if no hit or a PickingInfo

multiIntersects

Find examples in Playground
  • Intersects the sprites with a ray

    Parameters

    • ray: Ray

      defines the ray to intersect with

    • camera: Camera

      defines the current active camera

    • Optional predicate: function

      defines a predicate used to select candidate sprites

        • Parameters

          Returns boolean

    Returns Nullable<PickingInfo[]>

    null if no hit or a PickingInfo array

render

Find examples in Playground
  • render(): void

Generated using TypeDoc