Skip to content

HUD, input, camera and audio

These services exist only in a client resource.

Hud.SetText(id, text, options) places or updates a text item; Remove(id) and Clear() take items away. Options set the screen corner, an offset in 1080p-scaled pixels, colour and scale. Needs ui.hud.

For anything richer than a line of text, describe a HudPanel and let OMX draw it. A panel is declarative: you supply a title, status, metrics, a progress bar, detail rows and buttons, and OMX handles layout, input, theme and accessibility.

Hud.SetPanel("company", new HudPanel
{
Title = "Virtual Bus Company",
Status = "On shift",
StatusTone = HudTone.Positive,
Metrics = [new HudMetric("Today", "42.1 km"), new HudMetric("Pay", "£63.15")],
Actions = [new HudButton("clock-out", "Clock out", HudTone.Warning)],
});
Hud.ActionInvoked.Subscribe(action =>
{
if (action is { PanelId: "company", ActionId: "clock-out" }) ClockOut();
});

Raw drawing and general-purpose UI hooks are deliberately not public: text overlays and panels are the supported ways to show things.

Input works with OMSI’s own command pipeline from keyboard.cfg, so your resource follows the player’s bindings. Input.Changed reports commands going down and up, IsDown reads one, and SetCommand holds or releases a command as if the player had pressed it. Needs input.commands.

DriverView adjusts the driver view for the current bus: head offset, field of view, look-with-steering and look limits. Changes apply to the player’s view; ResetHead() puts the head back.

Audio.DistantScenery chooses how scenery sounds behave once their object leaves the tiles around the camera. By default OMX does what OMSI does; DistantScenerySounds.Stop stops them instead. Needs audio.behaviour.