Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Slot

Class for slot related methods and properties.

Slots are helper-objects which allow you to attach items to. Attached items move with the slot and are treated as child of the item they are attached to.

By default, all items have a "Top" and "Bottom" slot.

Hierarchy

  • Slot

Index

Constructors

Properties

name: string
returns

the name of this Slot.

owner: BaseItem
returns

the owner item of this Slot.

relativeTransform: ReadonlyTransform
returns

the relative ReadonlyTransform of this Slot.

returns

the ReadonlyTransform of this Slot.

Methods

  • adjustTo(target: Slot): boolean
  • Moves this Slot to another one. The owner of this Slot assumes rotation of the target but is not parented.

    Example

    //Moves itemA to the top of itemB.
    //itemA is not parented
    let itemA = Scene.getItem('itemA')
    let itemB = Scene.getItem('itemB')
    let itemASlot = itemA.getSlot('Top')
    let itemBSlot = itemA.getSlot('Bottom')

    itemASlot.adjustTo(itemBSlot)

    Parameters

    • target: Slot

      the target Slot this Slot should be moved to.

    Returns boolean

  • attachTo(target: Slot): void
  • Attaches this Slot to another one. The owner of this Slot assumes rotation of the target and is parented.

    Example

    //Attaches and parents itemA to itemB via their slots
    let itemA = Scene.getItem('itemA')
    let itemB = Scene.getItem('itemB')
    let itemASlot = itemA.getSlot('Top')
    let itemBSlot = itemA.getSlot('Bottom')

    itemASlot.attachTo(itemBSlot)

    Parameters

    • target: Slot

      the target Slot this Slot should be attached to.

    Returns void