ReferenceScripting APIMotionSceneonSensor
MotionScene.onSensor
methodListens for one of the scene's sensors' readings.
| Name | onSensor |
|---|---|
| Kind | method of MotionScene |
| Called as | scene.onSensor(…) |
| As a node | On Sensor Reading (logic graph) |
| Since | 0.4 |
Syntax
onSensor<T>( name: string, fn: (value: T, at: number) => void): () => voidParameters
| Name | Type | Description |
|---|---|---|
name | string | The name it's shared as, or its sensor's id |
fn | (value: T, at: number) => void | Runs with each new reading's value and when (ms) |
Returns
() => void: a function that stops listening.
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.