This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Drivers

A car's logic (a "Car" class) is controlled only by the car's physics and signals. It also has all functionality necessery to drive a car. Any car (user-controlled or AI-controlled) needs a "driver" to follow road regulations.

For this purpose, there is a special base class called "Driver". Each car should have an instance of this class to be controlled.

A "Driver" class implements the following:

  • Search for the road and road's direction.
  • Evaluation of the amount of lanes.
  • Recognition of the lane, along which a car is moving.

Crossroads logic can also influence the "Driver" class. When a driver enters the crossroads (no matter if it is a user-controlled or AI-controlled driver), it receives the crossroad driving spline and driving priority value. A spline is defined the following ways:

  • For user-controlled cars: based on activated turn signals.
  • For AI-controlled cars: chosen randomly.

All of the drivers make decisions for further movements based on these splines and driving priority values. Thus, "drivers" act like they do on real roads: they look around, look at other cars and their turn signals, look at stop signals, and look at crosswalks and let pedestrians pass by.

Control Keys

To control a car with a keyboard use the following keys:

Common

  • A / Left Arrow - turn left
  • D / Right Arrow - turn right
  • Space - brake
  • Shift - hand-brake
  • H - turn the headlights on/off
  • Q / Home - turn the left-turn signal on/off
  • E / PgUp - turn the right-turn signal on/off

Automatic Gearbox

  • W / Up Arrow - gas if moving forward (brake if moving backward)
  • S / Down Arrow - brake if moving forward (gas if moving backward)

Manual Gearbox

  • W / Up Arrow - gas
  • S / Down Arrow - brake
  • J - lower the gear
  • K - increase the gear

Other

  • F - enable the free-flying camera
  • G - enable the player camera
Notice
Joystick control is also supported. Check the driver_player.h file to see how its logic is implemented.
Last update: 03.07.2017
Build: ()