NWH Wheel Controller 3D
Search Results for

    Show / Hide Table of Contents

    Input

    Wheel Controller does not impose an input architecture. A WheelController simulates one wheel and accepts control values through properties such as motorTorque, brakeTorque, and steerAngle. A vehicle controller is responsible for reading the player's input and writing those values.

    The standalone Base Sample includes CarController, a small example controller that uses Unity's Input System. It does not use the legacy Input Manager or the Vehicle Physics input-provider system.

    Requirements

    The Wheel Controller package declares com.unity.inputsystem as a dependency. In Edit > Project Settings > Player, set Active Input Handling to Input System Package (New) or Both.

    To use the sample controller, import the samples in this order:

    1. In NWH Common Package > Samples, import Common Base Sample.
    2. In NWH Wheel Controller 3D > Samples, import Base Sample.

    Standalone Sample Flow

    The package ships the CarInputActions action asset and generated C# wrapper. The Base Sample's CarController uses them as follows:

    1. Awake() creates a CarInputActions instance and enables it.
    2. FixedUpdate() reads CarControls.Steering, CarControls.Throttle, and CarControls.Handbrake.
    3. The controller converts those values into each configured wheel's steerAngle, motorTorque, and brakeTorque.
    4. OnDestroy() disables and disposes the action wrapper.

    No input-provider component needs to be added to the scene for this standalone sample.

    Shipped Bindings

    The current CarInputActions asset contains one action map named CarControls.

    Action Value Keyboard Gamepad Sample behavior
    Steering -1 to 1 A / D Left stick left / right Steers entries whose Steer option is enabled.
    Throttle -1 to 1 S / W Right trigger (positive only) Positive drives forward, negative drives in reverse, and opposite input brakes while the vehicle is moving.
    Handbrake 0 to 1 Space East button Applies braking to entries whose Handbrake option is enabled.

    The sample smooths steering and treats Handbrake values greater than 0.5 as pressed.

    Custom Input

    For a custom standalone controller, read input with Unity's Input System (or another input package that your project declares) and assign the resulting values to the Wheel Controller API:

    • Set WheelController.steerAngle in degrees.
    • Set WheelController.motorTorque in newton-metres.
    • Set WheelController.brakeTorque in newton-metres.

    Apply control values from a physics-timed path such as FixedUpdate(). The WheelControllerManager handles wheel simulation and substeps automatically; input code should not call wheel simulation methods itself.

    Vehicle Physics Boundary

    VehicleInputProviderBase, VehicleInputHandler, InputSystemVehicleInputProvider, and MobileVehicleInputProvider belong to NWH Vehicle Physics 2, not to the standalone Wheel Controller API. The scene-input providers in NWH Common support shared demo features; they do not supply throttle, steering, or handbrake values to the standalone CarController.

    When Wheel Controller is used through NWH Vehicle Physics 2, do not add the standalone CarController. Configure input through the NWH Vehicle Physics documentation instead.

    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics