API ReferenceGE Extensionsflowgraphnodesmathsmoothers
Nonlinear Smoother (Flowgraph Node)
- **Node Name:** `Nonlinear Smoother`
Overview
- Node Name:
Nonlinear Smoother - Category:
simple - File:
extensions/flowgraph/nodes/math/smoothers/nonLinear.lua
Provides nonlinear (exponential-style) 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 | TemporalSmoothingNonLinear object created on init |
self.oldSet | Tracks previous set value to detect changes |
How It Works
- On init, a
newTemporalSmoothingNonLinear()object is created. - If the
setpin changes, the smoother's internal state is directly set. - If no
valueinput is provided, the current smoother state is output. - Otherwise, the rate is chosen by direction (increasing →
upRate, decreasing →downRate, default 1). - The smoother uses
getWithRate(sample, dt, rate)- nonlinear (exponential decay) smoothing.
Unlike the linear smoother, this produces an asymptotic approach to the target value.
Lua Example
-- Smooth camera follow distance:
-- value = target distance
-- dt = frame delta time
-- upRate = 3 (pull back quickly)
-- downRate = 1 (zoom in slowly)
-- Output: smooth camera distanceKey Dependencies
newTemporalSmoothingNonLinear()- BeamNG nonlinear temporal smoothing primitiveui_imgui- displays smoother state in the node editor_flowgraph_createNode()- standard flowgraph node registration
Additional Methods
C:checkSetValue()
Node method.
C:drawMiddle(builder, style)
Custom ImGui drawing in the middle section of the node in the editor.
Parameters:
builderstyle
C:work()
Main work function called each frame/tick when the node is active.
See Also
- Linear Smoother (Flowgraph Node) - Related reference
- Sigmoid Smoother (Flowgraph Node) - Related reference
- Spring Smoother (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide