FollowersFloat
- Last UpdatedDec 07, 2023
- 3 minute read
The FollowersFloat element implements an sfloat follower. A follower is a node that generates values trying to approximate a destValue.
The usage can be:
-
Static
-
Following a static destValue
-
Dynamic following a variable destValue
Instances of this node can be used to implement a sort of low pass filter that reduces the variation slope of a variable.
Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Writing values
Writing a value in a field means generating an event, even if the same value is written over and over again.
For example, if runType field is set to loop, and type field is set to delay and both currentValue and destValue are set to 1, a new event relative to the change of currentValue will be generated at every logic frame, even if it gets rewritten with the same value of 1.
Configuration of runType field
This table describes the behavior of writing values, depending on the configuration of the runType field.
|
Configuration |
Action |
|---|---|
|
The currentValue field is written at every logic frame execution, whether or not the currentValue has reached the value of the destValue field. |
|
The currentValue field is written until it reaches the value of destValue. It stops being written when they are equal. |
Code example
This is a code example for the FollowersFloat node.
<FollowersFloat name="b_addfollow" destValue="0" time="0.2"/>
Position
The Followersfloat node must be inside a context node, such as Context or Global.
FollowersFloat fields
These are the fields for FollowersFloat node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > FollowersFloat
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
active |
sbool |
ptional |
true |
Used to activate or deactivate the node instance. |
|
currentValue |
sfloat |
Read only |
Not set |
The follower output value. |
|
delayCoeff |
sfloat |
Optional |
0.2 |
Used in delay mode to define the low pass filtering delay. |
|
destValue |
sfloat |
Optional |
Not set |
The destination value. Can be set statically or dynamically. |
|
runType |
senum |
Optional |
oneshot |
When set to oneshot, the currentValue field is written until it reaches the value of destValue. It stops being written when they are equal. When set to loop, the currentValue field is written at every logic frame execution, whether or not the currentValue has reached the value of the destValue field. |
|
startValue |
sfloat |
Optional |
Not set |
The value from which the follower begins to follow the destValue. |
|
time |
sfloat |
Optional |
1 |
Used in linear mode. Defines the time in which the linear interpolation reaches destValue. |
|
type |
senum |
Ooptional |
Linear |
Defines the following mode: linear for linear interpolation and delay for low-pass filtering. |