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

Vehicle Odometer for Dashboard

Overview

The Odometer feature accumulates distance driven during the current session and displays it using up to six rotating digit cylinders (maximum display: 999999). The current implementation does not provide a digital display option. The initial displayed reading is randomized when the vehicle is initialized.

Dummy and Cylinder Setup

  1. Dummy Setup:

    • Add a dummy to your model and name it x_odometer. This dummy will serve as the anchor for the odometer setup.
  2. Cylinder Objects:

    • Under the x_odometer dummy, add 6 cylinder-shaped objects with 10 faces each. These cylinders represent the individual digits of the odometer.

Cylinder Placement

  • Positioning: Arrange the cylinders from right to left, ensuring visibility of all digits (e.g., 000000) from the dashboard.
  • Rotation: The script assumes the positioning of cylinders from right to left and rotates them accordingly to display the value. Keep this in mind while arranging the cylinders.

Example

Suppose you want to create an Analog Odometer for your vehicle:

  • Add a dummy to your model and name it x_odometer.

  • Under x_odometer, add 6 cylinder-shaped objects with 10 faces each, positioned and rotated appropriately to display the odometer digits.

    x_odometer
    ├── Cylinder_6 (10 faces)
    ├── Cylinder_5 (10 faces)
    ├── Cylinder_4 (10 faces)
    ├── Cylinder_3 (10 faces)
    ├── Cylinder_2 (10 faces)
    ├── Cylinder_1 (10 faces)
    

By following these instructions, you integrate the Odometer feature into your model, ensuring a realistic representation of the distance traveled 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_odometer": {
        "kph": true
      }
    }
}

kph selects the odometer's distance multiplier.

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