Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SnapPoint

A snap point connected to an object

Hierarchy

  • SnapPoint

Index

Methods

getFlipValidity

  • getFlipValidity(): number

getGlobalPosition

getIndex

  • getIndex(): number
  • Return the index of the snap point in the list of snap points for the object (as defined in the editor)

    Returns number

getLocalPosition

  • Get the position of the snap point relative to its parent object

    Returns Vector

getParentObject

  • Return the object to which the snap point is connected. Will return undefined if the snap point is not attached to a GameObject, but directly to the table.

    Returns StaticObject | undefined

getRange

  • getRange(): number
  • Return the snapping range of the snap point

    Returns number

getShape

  • getShape(): number

getSnapRotation

  • getSnapRotation(): number
  • Return the relative rotation around the Z axis to which the snap point snaps (if rotation snapping is active)

    Returns number

getSnapRotationType

  • getSnapRotationType(): number

getSnappedObject

  • getSnappedObject(sphereRadius?: number, restrictTags?: boolean): GameObject | undefined
  • Return the object that is snapped to this point. Returns undefined if no object is found. Objects are not bound to snap points when they are snapped, only their position is adjusted. Therefore, this method is not guaranteed to work correctly. It uses a line trace upwards from the snap point, and if that doesn't find anything a sphere overlap centered at the snap point. The closest object found in either of the traces is returned.

    Parameters

    • Optional sphereRadius: number

      Radius to use for the sphere overlap. If not specified, a quarter of the snap point range is used.

      • @param {bool} restrictTags - If true, only return objects that match the snap point's tags (and therefore would snap to it)
    • Optional restrictTags: boolean

    Returns GameObject | undefined

getTags

  • getTags(): string[]
  • Get tags of this snap point. Only objects that share at least one tag will be snapped. If empty, all objects will be snapped.

    Returns string[]

isValid

  • isValid(): boolean
  • Return whether the object is valid. A snap point becomes invalid after the object it belongs to has been destroyed

    Returns boolean

snapsRotation

  • snapsRotation(): boolean
  • Return whether the snap point changes rotation of the snapped object. Use getSnapRotationType to get the exact type of rotation change

    Returns boolean