Brakes (for Bikes) - user-grinch/ModelExtras GitHub Wiki

🏍️ Overview

This feature enables realistic, functional brakes for bike models, allowing separate control of:

  • Front brakes → Controlled by the hand brake key
  • Rear brakes → Controlled by the brake pedal key

Each brake rotates a specific part of the bike based on the applied brake and a configured rotation value. You can set this rotation using:

  1. Dummy Object Names → A quick but basic method.
  2. JSONC Configuration → A more flexible and recommended approach.

🔄 How Brakes Work

  • Front Brake (x_fbrake) → Rotates the frame dummies along the Z-axis.
  • Rear Brake (x_rbrake) → Rotates the frame dummies along the X-axis.
  • Rotation activates dynamically based on brake input.

🛠️ How to Set Up

🔹 Method 1: Using Dummy Objects (Basic Setup)

  1. Add two dummy objects inside your bike model:
    • x_fbrake_<rotation_value>(e.g., x_fbrake_90 for a 90° front brake rotation)
    • x_rbrake_<rotation_value>(e.g., x_rbrake_45 for a 45° rear brake rotation)
  2. Attach brake components (calipers, discs, pads) to these dummies.
  3. Save your model and test in-game.

🔹 Method 2: Using JSONC Configuration (Recommended)

Instead of renaming dummies, you can define brake rotation values via a JSONC file inside ModelExtras/data/.

📂 File Location & Naming

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

📝 Example JSONC Configuration

{
    "frontbrake": {
        "maxrotation": 90.0
    },
    "rearbrake": {
        "maxrotation": 45.0
    }
}

🎮 Expected Behavior

In-Game Controls:

🔹 Press hand brake (Space) → Front brake applies (Z-axis rotation)
🔹 Press brake pedal (Back Button) → Rear brake applies (X-axis rotation)

This setup allows for realistic braking physics, enhancing the gameplay experience. 🚀