• Public
  • Public/Protected
  • All

Class SurfaceMagnetismBehavior

A behavior that allows a transform node to stick to a surface position/orientation




  • SurfaceMagnetismBehavior




enabledSearch playground for enabled

enabled: boolean

Is this behavior reacting to pointer events

hitNormalOffsetSearch playground for hitNormalOffset

hitNormalOffset: number

Distance offset from the hit point to place the target at, along the hit normal.

interpolatePoseSearch playground for interpolatePose

interpolatePose: boolean

Set to false if the node should strictly follow the camera without any interpolation time

keepOrientationVerticalSearch playground for keepOrientationVertical

keepOrientationVertical: boolean

If true, pitch and roll are omitted.

lerpTimeSearch playground for lerpTime

lerpTime: number

Rate of interpolation of position and rotation of the attached node. Higher values will give a slower interpolation.

maxStickingDistanceSearch playground for maxStickingDistance

maxStickingDistance: number

Maximum distance for the node to stick to the surface

meshesSearch playground for meshes

meshes: AbstractMesh[]

Spatial mapping meshes to collide with



  • get name(): string
  • Name of the behavior

    Returns string


attachSearch playground for attach

  • Attaches the behavior to a transform node


    • target: Mesh

      defines the target where the behavior is attached to

    • Optional scene: Scene

      the scene

    Returns void

detachSearch playground for detach

  • detach(): void
  • Detaches the behavior

    Returns void

findAndUpdateTargetSearch playground for findAndUpdateTarget

  • Finds the intersection point of the given ray onto the meshes and updates the target. Transformation will be interpolated according to interpolatePose and lerpTime properties. If no mesh of meshes are hit, this does nothing.


    • pickInfo: PickingInfo

      The input pickingInfo that will be used to intersect the meshes

    Returns boolean

    a boolean indicating if we found a hit to stick to

initSearch playground for init

  • init(): void
  • Function called when the behavior needs to be initialized (after attaching it to a target)

    Returns void

updateAttachPointSearch playground for updateAttachPoint

  • updateAttachPoint(): void
  • Updates the attach point with the current geometry extents of the attached mesh

    Returns void


  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method