SpriteManager

Class used to manage multiple sprites on the same spritesheet

see

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

Hierarchy

  • SpriteManager

Implements

Index

Constructors

constructor

Find examples in Playground
  • new SpriteManager(name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number): 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

    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

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

onDispose

Find examples in Playground
onDispose: function

Callback called when the manager is disposed

Type declaration

    • (): void
    • Returns void

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

texture

Find examples in Playground
texture: Texture

Gets or sets the spritesheet texture

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

render

Find examples in Playground
  • render(): void

Generated using TypeDoc