Available in the Gaming / Industries Circle
quantum | v2 switch to v1  

Input

Overview

トップに戻る
 

Unity

On the Unity side, the Arcade Racing Sample uses simple polling via the old Unity input system. The implementation can be found in GameplayInput.cs.

トップに戻る
 

Quantum

Input Struct

The Quantum input struct is extremely compact and only contains one byte and one signed byte:

  • Byte Flags are used for a compressed representation of button actions (accelerate, decelerate, nitro, horn, hand brake); and,
  • SByte Steering is used for an analog representation of steering. Unity’s horizontal input axis float (-1 to 1) mapped to sbyte (-127 to 127);

トップに戻る
 

Simulation

In the simulation, the input is tied to InputDesires to provide a single entry point for input generated by Players and AI alike.

  1. Input is processed using the helper struct InputDesires (defined in Player.InputDesires.cs) in the Vehicle and Steering components.
  2. InputDesires are filled in by either:
    • a player’s input polled from Unity (see the Player.Update method); or,
    • AI input (see AI.Update method). The AI generates input using the AIHandling asset which can be easily swapped to further alter the AI's behavior.

ドキュメントのトップへ戻る