Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Physics::Component::Vehicle Struct Reference

Main vehicle component containing all configuration. More...

#include <Vehicle.hpp>

Static Public Member Functions

static std::array< glm::vec3, 4 > GetDefaultWheelPositions ()
 Get default wheel positions relative to chassis center.
static Vehicle CreateDefaultCar ()
 Create a default RWD sports car configuration.

Public Attributes

std::array< WheelSettings, static_cast< size_t >(WheelIndex::Count)> wheels
 Wheel settings for all 4 wheels (indexed by WheelIndex).
DrivetrainType drivetrain = DrivetrainType::RWD
 Drivetrain configuration.
EngineSettings engine
 Engine configuration.
GearboxSettings gearbox
 Gearbox configuration.
RollbarSettings rollbar
 Rollbar configuration.
std::array< Engine::EntityId, 4 > wheelEntities
 Wheel entities for visual representation.
std::array< glm::vec3, 4 > wheelPositions = GetDefaultWheelPositions()
 Wheel positions relative to chassis center.
CollisionTesterType collisionTesterType = CollisionTesterType::CastCylinder
 Collision tester type for wheel-ground detection (default: CastCylinder).
float convexRadiusFraction = 0.5f

Detailed Description

Main vehicle component containing all configuration.

This is the user-facing component that defines vehicle behavior. Attach this to the chassis entity to create a drivable vehicle.

Member Function Documentation

◆ CreateDefaultCar()

Vehicle Physics::Component::Vehicle::CreateDefaultCar ( )
inlinestatic

Create a default RWD sports car configuration.

◆ GetDefaultWheelPositions()

std::array< glm::vec3, 4 > Physics::Component::Vehicle::GetDefaultWheelPositions ( )
inlinestatic

Get default wheel positions relative to chassis center.

Default positions assume a standard car layout:

  • Front wheels: ±0.9 X, +1.2 Z
  • Rear wheels: ±0.9 X, -1.2 Z
  • All wheels: -0.3 Y (below chassis center)
Returns
Array of wheel positions indexed by WheelIndex

Member Data Documentation

◆ collisionTesterType

CollisionTesterType Physics::Component::Vehicle::collisionTesterType = CollisionTesterType::CastCylinder

Collision tester type for wheel-ground detection (default: CastCylinder).

◆ convexRadiusFraction

float Physics::Component::Vehicle::convexRadiusFraction = 0.5f

Convex radius fraction for CastCylinder tester (0.0 to 1.0) Higher values help prevent ghost collisions (default: 0.5, increase if needed)

◆ drivetrain

DrivetrainType Physics::Component::Vehicle::drivetrain = DrivetrainType::RWD

Drivetrain configuration.

◆ engine

EngineSettings Physics::Component::Vehicle::engine

Engine configuration.

◆ gearbox

GearboxSettings Physics::Component::Vehicle::gearbox

Gearbox configuration.

◆ rollbar

RollbarSettings Physics::Component::Vehicle::rollbar

Rollbar configuration.

◆ wheelEntities

std::array<Engine::EntityId, 4> Physics::Component::Vehicle::wheelEntities

Wheel entities for visual representation.

◆ wheelPositions

std::array<glm::vec3, 4> Physics::Component::Vehicle::wheelPositions = GetDefaultWheelPositions()

Wheel positions relative to chassis center.

◆ wheels

std::array<WheelSettings, static_cast<size_t>(WheelIndex::Count)> Physics::Component::Vehicle::wheels

Wheel settings for all 4 wheels (indexed by WheelIndex).


The documentation for this struct was generated from the following file: