Files
metaverseDubai/docs/VEHICLE_SYSTEM.md

5.8 KiB

Vehicle System - Dubai Metaverse

Overview

This document describes the vehicle system implementation using Chaos Physics for the Dubai Metaverse project.

Chaos Vehicle System

Overview

Chaos Vehicle is Unreal Engine 5's physics-based vehicle simulation system. It provides realistic vehicle physics and handling.

Setup

  1. Enable Chaos Physics:

    • Project Settings > Physics > Chaos Physics
    • Enable Chaos Vehicle
  2. Vehicle Blueprint:

    • Create vehicle blueprint
    • Add Chaos Vehicle components
    • Configure physics settings

Vehicle Assets

Dubai Supercars

Lamborghini

  • Model: SM_Vehicle_Lamborghini
  • Blueprint: BP_Vehicle_Lamborghini
  • Type: Supercar
  • Characteristics:
    • High speed
    • High acceleration
    • Sporty handling

G-Wagon

  • Model: SM_Vehicle_GWagon
  • Blueprint: BP_Vehicle_GWagon
  • Type: Luxury SUV
  • Characteristics:
    • High ground clearance
    • Stable handling
    • Luxury aesthetic

Ferrari

  • Model: SM_Vehicle_Ferrari
  • Blueprint: BP_Vehicle_Ferrari
  • Type: Supercar
  • Characteristics:
    • High speed
    • High acceleration
    • Sporty handling

Vehicle Blueprint Setup

BP_VehicleBase

Base class for all vehicles

Components

  1. Chaos Vehicle Movement Component:

    • Main vehicle physics component
    • Handles acceleration, braking, steering
    • Configures vehicle dynamics
  2. Mesh Component:

    • Vehicle static mesh
    • Visual representation
  3. Camera Component (optional):

    • Third-person camera
    • First-person camera (if needed)
  4. Audio Component:

    • Engine sounds
    • Tire sounds
    • Other vehicle sounds

Physics Settings

Engine

  • Max RPM: 6000-8000
  • Torque: High for supercars
  • Gear Ratios: Configure for vehicle type

Transmission

  • Type: Automatic or Manual
  • Gear Count: 6-8 gears
  • Shift Points: Configure shift points

Suspension

  • Spring Rate: Adjust for vehicle type
  • Damping: Adjust for handling
  • Travel: Suspension travel distance

Tires

  • Friction: Tire friction coefficient
  • Pressure: Tire pressure
  • Radius: Tire radius

Vehicle Controller

BP_VehicleController

Purpose: Handle player input and vehicle control

Input Mapping

  • Throttle: W key / Gamepad trigger
  • Brake: S key / Gamepad trigger
  • Steering: A/D keys / Gamepad stick
  • Handbrake: Space key / Gamepad button

Implementation

  1. Input Handling:

    • Capture player input
    • Convert to vehicle commands
    • Send to vehicle movement component
  2. Camera Control:

    • Third-person camera follow
    • Camera smoothing
    • Camera offset
  3. UI:

    • Speedometer (optional)
    • Gear indicator (optional)

AI Traffic System

PCG_Traffic Graph

Purpose: Generate AI traffic on roads

Implementation

  1. Spline System:

    • Create road splines
    • Define traffic paths
    • Set traffic direction
  2. Vehicle Spawning:

    • Spawn vehicles at intersections
    • Spawn vehicles at entry points
    • Vary vehicle types
  3. AI Movement:

    • Follow spline paths
    • Maintain speed
    • Avoid collisions

AI Vehicle Controller

  1. Spline Following:

    • Follow road splines
    • Maintain lane position
    • Adjust speed
  2. Traffic Behavior:

    • Stop at intersections (optional)
    • Yield to other vehicles
    • Maintain safe distance

Vehicle Materials

Paint Materials

  • M_Vehicle_Paint: Base paint material
  • Variations: Different colors per vehicle
  • Properties:
    • High reflectivity
    • Low roughness
    • Metallic (for some colors)

Material Instances

  • MI_Vehicle_Lamborghini_Yellow: Yellow paint
  • MI_Vehicle_Lamborghini_Orange: Orange paint
  • MI_Vehicle_GWagon_Black: Black paint
  • MI_Vehicle_Ferrari_Red: Red paint

Vehicle Audio

Engine Sounds

  • A_Vehicle_Engine_Lamborghini: Lamborghini engine
  • A_Vehicle_Engine_GWagon: G-Wagon engine
  • A_Vehicle_Engine_Ferrari: Ferrari engine

Implementation

  1. Audio Component:

    • Attach to vehicle
    • Play engine sound
    • Adjust pitch based on RPM
  2. Tire Sounds:

    • Tire screech on hard braking
    • Tire squeal on sharp turns

Performance Optimization

Vehicle Optimization

  1. LODs: Use LODs for distant vehicles
  2. Culling: Cull vehicles outside view
  3. Instancing: Use instanced meshes for traffic

Physics Optimization

  1. Update Frequency: Optimize physics update rate
  2. Collision: Optimize collision shapes
  3. Simulation: Limit physics simulation distance

Testing

Vehicle Testing

  1. Handling: Test vehicle handling
  2. Physics: Verify physics are realistic
  3. Performance: Test performance with vehicles
  4. Audio: Test vehicle audio

Traffic Testing

  1. Spawn Rate: Test vehicle spawn rate
  2. AI Behavior: Test AI traffic behavior
  3. Performance: Test performance with traffic
  4. Collisions: Test collision avoidance

Troubleshooting

Common Issues

Issue: Vehicle handling too sensitive/loose

  • Solution: Adjust suspension settings
  • Solution: Adjust tire friction

Issue: Vehicle not accelerating

  • Solution: Check engine torque settings
  • Solution: Check transmission settings

Issue: AI traffic not moving

  • Solution: Check AI controller setup
  • Solution: Verify spline paths

Issue: Performance issues

  • Solution: Reduce vehicle count
  • Solution: Optimize vehicle meshes
  • Solution: Use LODs

Documentation

Vehicle Specifications

Document each vehicle:

  • Model name
  • Blueprint name
  • Physics settings
  • Material settings
  • Audio settings

Controls

Document vehicle controls:

  • Input mapping
  • Camera controls
  • Special features

Version: 1.0 Last Updated: [Current Date]