Class MicroMobilitySpeedometer
A speedometer interface designed specifically for micro-mobility vehicles that displays speed using three separate renderers, each representing a single digit.
public class MicroMobilitySpeedometer : Speedometer
Inheritance
Inherited Members
- Speedometer.speedDisplayScale
- Speedometer.speedDisplayUnit
- Speedometer.SetRawSpeed(float)
- Speedometer.ConvertRawSpeed(float, Speedometer.SpeedUnit)
Remarks
This implementation splits the speed display into hundreds, tens, and ones digits, allowing for retro or segmented displays typical of certain micro-mobility dashboards.
Fields
updateInterval
The duration in seconds between each speedometer update cycle. Controls how often the digit renderers are refreshed.
[Tooltip("Time interval (in seconds) between speedometer updates.")]
[SerializeField]
public float updateInterval
Field Value
float
Methods
SetRawSpeed(float)
Sets the current raw speed sample (in meters per second) for this speedometer.
public override void SetRawSpeed(float rawSpeed)
Parameters
| Name | Type | Description |
|---|---|---|
rawSpeed | float | The actor's speed in meters per second (m/s), typically the magnitude of its velocity. |
Remarks
Implementations should convert to the configured display unit, multiply by
speedDisplayScale, and take the absolute value before updating any visuals,
Call this whenever a new speed value is available (e.g., per FixedUpdate).
Keep implementations allocation-free and fast; this may be invoked frequently.
A common pattern is:
var converted = Mathf.Abs(ConvertRawSpeed(Mathf.Max(0f, rawSpeed), speedDisplayUnit) * speedDisplayScale); // Update UI/needle/text/etc. with 'converted'