GaugeProfile
public sealed class GaugeProfileNamespace Chassis.Api
Added in 1.2.0
One display in the cockpit: a needle that turns with a value, a lamp that glows above a threshold, or digits. It reads a source by name (ChassisApi.GaugeSources) and moves a transform of the vehicle’s model or interior. Chassis draws gauges on every peer, for vehicles near the camera.
Example
A speedometer needle that sweeps from 0 to 160 km/h across 270 degrees:
profile.Gauges.Add(new GaugeProfile { Name = "speedo", Kind = "needle", Path = "Dash/SpeedoNeedle", Source = "speed_kmh", Min = 0f, Max = 160f });Fields
Section titled “Fields”public string Name = string.EmptyAdded in 1.2.0
Name the debug output and warnings use, e.g. “speedo”.
public string Kind = "needle"Added in 1.2.0
“needle”, “lamp” or “digits”.
Value “needle” turns the transform at Path from From to To degrees about Axis. “lamp” makes every renderer below it glow in Color while the value is above Threshold. “digits” puts a text below it that shows the value in Format.
public string Path = string.EmptyAdded in 1.2.0
The transform to move, light or write on, below the vehicle’s frame.
Value A path like “Chassis_Interior/Dash/SpeedoNeedle”, or one name like “SpeedoNeedle” that is searched in the whole frame. A needle’s transform should sit at the pivot of the needle. Chassis logs one warning per vehicle code when the path is not found.
Source
Section titled “Source”public string Source = "speed"Added in 1.2.0
The value the gauge shows, by source name.
Value A built-in source such as “speed”, “rpm”, “lights” or “clock_hours”, or a name a mod registered with ChassisApi.RegisterGaugeSource. The full list with units is on ChassisApi.GaugeSources.
public float MinAdded in 1.2.0
Needle: the value at From. Values outside Min and Max stop at the end of the dial.
Value In the unit of the source, e.g. 0 for a speedometer.
public float Max = 1fAdded in 1.2.0
Needle: the value at To.
Value In the unit of the source, e.g. 160 for a speedometer that ends at 160 km/h.
public float From = -135fAdded in 1.2.0
Needle: angle at Min, in degrees about Axis from the needle’s rest pose.
Value With the default axis (0, 0, -1) on a needle that points up at rest, -135 points to the lower left as the driver sees it.
public float To = 135fAdded in 1.2.0
Needle: angle at Max, in degrees.
Value 135 points to the lower right with the default axis; From -135 to To 135 sweeps 270 degrees clockwise.
public Vector3 Axis = new Vector3(0f, 0f, -1f)Added in 1.2.0
Needle: the turning axis in the needle transform’s own space.
Value A direction. (0, 0, -1) turns clockwise as seen by a driver who looks along the vehicle’s forward axis at a dial that faces back towards them.
Smooth
Section titled “Smooth”public float Smooth = 0.12fAdded in 1.2.0
Needle and digits: seconds the shown value takes to follow the source; 0 follows at once.
Threshold
Section titled “Threshold”public float Threshold = 0.5fAdded in 1.2.0
Lamp: glows while the value is above this.
Value 0.5 suits the on/off sources, which read 0 or 1.
public Color Color = new Color(1f, 0.42f, 0f)Added in 1.2.0
Lamp: glow colour. Digits: text colour.
Value Channels from 0 to 1. In JSON: [1, 0.42, 0, 1] for amber.
Format
Section titled “Format”public string Format = "0"Added in 1.2.0
Digits: number format of the value.
Value A .NET numeric format in invariant culture: “0” for whole numbers, “0.0” for one decimal, “000000” for an odometer with leading zeros. The source “clock” formats as “00:00” by itself.
public float Size = 0.025fAdded in 1.2.0
Digits: height of one line of text in metres.
Value 0.02 to 0.03 reads well on a dashboard at arm’s length.