Motion
Get Motion

ReferenceScripting APIMotionSceneonSensor

MotionScene.onSensor

method

Listens for one of the scene's sensors' readings.

NameonSensor
Kindmethod of MotionScene
Called asscene.onSensor(…)
As a nodeOn Sensor Reading (logic graph)
Since0.4

Syntax

onSensor<T>(    name: string,    fn: (value: T, at: number) => void): () => void

Parameters

NameTypeDescription
namestringThe name it's shared as, or its sensor's id
fn(value: T, at: number) => voidRuns with each new reading's value and when (ms)

Returns

() => void: a function that stops listening.