API ReferenceGE Extensionsflowgraphnodesmathsmoothers
Linear Smoother (Flowgraph Node)
- **Node Name:** `Linear Smoother`
Overview
- Node Name:
Linear Smoother - Category:
simple - File:
extensions/flowgraph/nodes/math/smoothers/linear.lua
Provides linear temporal smoothing for a numeric signal with configurable up/down rates.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
value | number | The target signal value |
dt | number | Delta time for smoothing |
upRate | number | Smoothing rate when value is increasing |
downRate | number | Smoothing rate when value is decreasing |
set | number | Directly set the smoother's internal state |
Output Pins
| Pin | Type | Description |
|---|---|---|
value | number | The smoothed output value |
Internals
| Field | Purpose |
|---|---|
self.smoother | TemporalSmoothing object created on execution start |
self.oldSet | Tracks previous set value to detect changes |
How It Works
- On execution start, a
newTemporalSmoothing()object is created. - If the
setpin changes, the smoother's internal state is directly set to that value. - If no
valueinput is provided, the current smoother state is output unchanged. - Otherwise, the rate is selected based on direction (increasing →
upRate, decreasing →downRate, default 1). - The smoother is updated via
getWithRateUncapped(sample, dt, rate)- linear interpolation without capping.
Lua Example
-- Smooth a throttle input:
-- value = raw throttle (0-1)
-- dt = frame delta time
-- upRate = 2 (fast response up)
-- downRate = 5 (slower release)
-- Output: smoothed throttle valueKey Dependencies
newTemporalSmoothing()- BeamNG temporal smoothing primitiveui_imgui- displays smoother state in the node editor_flowgraph_createNode()- standard flowgraph node registration
Additional Methods
C:_executionStarted()
Called when graph execution starts. Used for initialization/reset.
C:checkSetValue()
Node method.
C:drawMiddle(builder, style)
Custom ImGui drawing in the middle section of the node in the editor.
Parameters:
builderstyle
C:init()
Initializes the node, setting up pins and default properties.
C:work()
Main work function called each frame/tick when the node is active.
See Also
- Nonlinear Smoother (Flowgraph Node) - Related reference
- Sigmoid Smoother (Flowgraph Node) - Related reference
- Spring Smoother (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide