VirtualHID, VHID for short, or Virtual Human Interface Device for long is a C++-built system in Train Sim World that simulates player interactions with trains and the world.
Similar to the Rail Vehicle setup, the VHID system has a model and view component, sitting on either the model and view actor of for example a Rail Vehicle or both on the same actor if no model-view destinction exists (e.g. DRA ticket stamper).
VirtualHIDInteractionComponent
The VirtualHIDInteractionComponent
takes over the view role and is linked to a model component through the InteractionModelComponent
variable. It works as is with all different child classes of VirtualHIDComponent
.
Having a FTransform
inhherited from SceneComponent
as well as a hitbox allows it to be used for click and/or drag interactions in the 3D world and playing interaction audio. The hitbox can take on a shape defined in EHitBoxShape
(Cube
, Sphere
, Sphyl
aka. Capsule).
It is also possible to attatch a VirtualHIDInteractionComponent
to a Socket and for example have it move with a lever.
VirtualHIDComponent
The VirtualHIDComponent
takes over the model role and defines the VHID's behaviour. Different child classes differentiate between different types of 'Human Interfaces Devices', mainly levers and buttons.
The display data for the HUD (display name; how to display values; overrides for specific values), something one would expect in the view component, is also set here as interactions with the VHID may still occur through keyboard/controller bindings even when the VirtualHIDInteractionComponent
is unloaded, yet still need to be displayed in the HUD.
Keyboard/Controller bindings are done by setting the InputIdentifier
variable and the InteractionEnvironmentComponent
in which the InputIdentifier
should be observed as input.