ControlProfile
public sealed class ControlProfileNamespace Chassis.Api
Added in 1.2.0
One switch in the cockpit a seated player can use in first person: look at it and click, or turn a knob with the mouse wheel. Everyone within reach (about 0.9 m from the eyes) can use it; the click goes through the host to every peer, and Chassis keeps and saves the state of toggles and knobs.
Example
A toggle for the headlights and a button for a mod’s own action:
profile.Controls.Add(new ControlProfile { Name = "lights", Kind = "toggle", Path = "Dash/LightSwitch", Action = "lights", Source = "lights" });profile.Controls.Add(new ControlProfile { Name = "siren", Kind = "button", Path = "Dash/SirenButton", Action = "mymod.siren" });Fields
Section titled “Fields”public string Name = string.EmptyAdded in 1.2.0
Name of the switch, unique in the profile; the saved state and ChassisApi.ControlValue use it.
public string Label = string.EmptyAdded in 1.2.0
The name the player reads under the centre dot while looking at the switch.
Value For example “Hazard lights”. Empty shows Name with a capital first letter and spaces for ”_”.
public string Kind = "button"Added in 1.2.0
“button”, “toggle” or “knob”.
Value “button” fires its action on a click and springs back. “toggle” flips between 0 and 1 on a click. “knob” steps between Min and Max with the mouse wheel; a click puts it back to Default.
public string Path = string.EmptyAdded in 1.2.0
The transform that moves and that the player aims at, below the vehicle’s frame.
Value A path or one name, searched as GaugeProfile.Path. Its renderers give the area to aim at unless BoxSize is set.
Action
Section titled “Action”public string Action = string.EmptyAdded in 1.2.0
What the switch does.
Value A built-in action: “lights” (headlights on/off), “hazard” (hazard lights on/off), “indicator” (a knob from -1 left to 1 right), “indicator_left”, “indicator_right”, “horn” or “trip_reset”. Any other name is a mod’s own action from ChassisApi.RegisterControlAction; empty does nothing but keep the state.
Source
Section titled “Source”public string Source = string.EmptyAdded in 1.2.0
A source whose value the switch shows instead of its own state, or empty.
Value For switches whose state can change without them: “lights” for a light switch (the light key also switches), “hazard”, “indicator”. Any source from ChassisApi.GaugeSources works.
public Vector3 Axis = Vector3.rightAdded in 1.2.0
The axis the switch turns about (toggle, knob) or moves along (button), in its own space.
Value A direction, e.g. (1, 0, 0) for a rocker switch that tips forward and back, (0, 0, 1) for a button pushed forward.
public float Angle = 30fAdded in 1.2.0
Toggle: degrees between off and on. Knob: degrees from Min to Max.
Value The rest pose is the middle: a toggle stands at -Angle/2 off and +Angle/2 on.
public float Press = 0.004fAdded in 1.2.0
Button: how far it moves along Axis while pressed, in metres.
public float MinAdded in 1.2.0
Knob: lowest value.
public float Max = 1fAdded in 1.2.0
Knob: highest value.
public float Step = 0.1fAdded in 1.2.0
Knob: change per notch of the mouse wheel.
Default
Section titled “Default”public float DefaultAdded in 1.2.0
Toggle and knob: the value before anyone touched it, and a knob’s value after a click.
BoxCenter
Section titled “BoxCenter”public Vector3 BoxCenterAdded in 1.2.0
Centre of the area to aim at, in the switch transform’s own space; used when BoxSize is set.
BoxSize
Section titled “BoxSize”public Vector3 BoxSizeAdded in 1.2.0
Size of the area to aim at in metres, in the switch transform’s own space; zero uses its renderers.
Value Set it for a switch with no renderer of its own, or to make a small one easier to hit.