Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SnapPoint

A snap point connected to an object

Hierarchy

  • SnapPoint

Index

Methods

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

getRange

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

    Returns 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

getSnappedObject

  • getSnappedObject(sphereRadius?: number): 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.

    Returns GameObject | undefined

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 also snaps rotation

    Returns boolean