Vehicles Management.

Vehicles Management

A Vehicle is a prefab containing:

  • A mesh for its visual representation
  • a Collider component to handle collisions with the racetrack, obstacles and other vehicles
  • TinyCars / Aphex : a component responsible for player interaction (XXXController)
    • component that will handle behavior (sounds, smoke, animations…) with no physics consequences (XXXBehavior)
  • Solid : a component for vehicle control (SolidController)
    • one component for each wheel responsible for suspension (WheelBehaviour)
    • one component for each effect like Smokes, Skidmarks, …
  • a component that will handle AI behavior (VehicleAI)
  • a descriptive component only used by the lobby (VehicleInformation)

Vehicle Controller

For each specific game, you should derive a class from BaseController. The BaseController implements input handling, and also handles basic properties such as speed, score or the vehicle’s position relative to the road.

Then each game’s controller must implement its specificities. For example in the RacingGame, there’s an OffRoad notion, but also reverse gear, while the Aphex game doesn’t implement that. Feel free to extend the BaseController to implement the gameplay and physics that will make your game stand out.

CarController inspector

Vehicle Behaviour

Depending on the Vehicle’s state, this class will activate visual or sound effects (smoke, skidmarks…)

CarBehaviour inspector

For the Solid vehicles, each effect is a component you add separately.

Solid Vehicle Controller

The Solid controller is a full vehicle controller that is meant to be more versatile and should allow you to create all sorts of vehicles, from an offroad truck to a Formula 1 without requiring any coding.

Solid Vehicle inspector

Vehicle Information

This simple component describes the name and image the vehicle should be displayed with on the lobbies.