Speedometer (for Vehicles) - user-grinch/ModelExtras GitHub Wiki



Speedometer Integration for Dashboard

Overview

The Speedometer feature displays the vehicle's speed on the dashboard with an analog display. The needle of the speedometer rotates on the Y-axis, providing a visual representation of the speed. Follow the instructions below to adapt your model for the Speedometer functionality.

Needle Naming and Positioning

  1. Needle Naming:

    • Name the needle of your Speedometer as x_sm.
  2. Needle Positioning:

    • Position the needle to point to 0 on the speed scale.

Example

Suppose you want to configure the Speedometer with a maximum speed of 160 mph and a rotation of 220 degrees to point to the maximum speed:

  • Name the needle x_sm.
  • Position the needle to point to 0 on the speed scale.
  • Configure the speed scale and sweep in JSONC as shown below. Name-encoded values such as x_sm_m160r220 and x_sm_kph are not interpreted; maxspeed and maxrotation are read from the JSONC entry.

By following these steps, you integrate the Speedometer feature into your model, providing a simulated representation of the vehicle's speed on the dashboard.

JSONC Configuration Method (Recommended)

Instead of renaming nodes manually, you can configure the data via JSONC, allowing easier tuning and adjustments.

📂 JSONC File Location & Structure

📌 Path: ModelExtras/data/<model_id or model_name>.jsonc
📌 Example File: ModelExtras/data/522.jsonc (for model_ID 522)

{
    "gauges": {
        "x_sm": {
            "maxspeed": 160,
            "maxrotation": 220.0,
            "kph": false
        }
    }
}

kph defaults to true. When set to false, ModelExtras converts the speed value from km/h to mph before applying maxspeed; choose maxspeed to match the dial's units and scale.

⚠️ **GitHub.com Fallback** ⚠️