NWH Vehicle Physics 2 Documentation
Docs » NWH:VehiclePhysics2:Input:SteeringWheelInputProvider

Steering Wheel Input Provider

The Logitech SDK approach below is currently the official way to implement steering wheel input. The alternative is https://github.com/imDanoush/Unity-DirectInput/, currently in beta. It is a 3rd party project that does not depend on the Logitech SDK and has better wheel compatibility for other manufacturers.

SteeringWheelInputProvider inspector.

SteeringWheelInputProvider adds steering wheel (Logitech/Thrustmaster/etc.) support to NWH Vehicle Physics 2.
Besides retrieving input from the wheel it also manages force feedback (FFB).
Logitech SDK is required for SteeringWheelInputProvider to work - check setup steps below. Despite the name, Logitech SDK also works with wheels from other manufacturers since it uses DirectInput as the backend.

This script requires two front wheels to function.

Setup

Assembly Definitions

Setting up .asmdef for Logitech SDK is required for v1.6 and up.

  • Logitech SDK does not come with .asmdef file so adding it manually is required. If this step is skipped SteeringWheelInputProvider will not be able to find the LogitechGSDK class.
  • Navigate to Logitech SDK directory inside the Unity Project view and right click > Create > Assembly Definition. Name it LogitechSDK
  • Navigate to the SteeringWheelInput directory that has been imported in the previous section and make sure that LogitechSDK is present in the NWH.VehiclePhysics2.SteeringWheelInput.asmdef file under the Assembly Definition References section. Example:
LogitechSDK reference added to the NWH.VehiclePhysics2.SteeringWheelInput.asmdef
Logitech SDK
  • Download Logitech SDK asset from Unity Asset Store (link). Logitech SDK is known to ship with problematic LogitechSteeringWheelEnginesWrapper.dll file. To fix this:
    • Download Steering Wheel SDK from Logitech Website (link).
    • Find correct LogitechSteeringWheelEnginesWrapper.dll inside the downloaded SDK and replace the one in the Unity project with it.
    • Restart Unity (important, Unity does not unload native dll files until restarted so the old dll will still be in memory).
    • Attach LogitechSteeringWheel from Logitech SDK ⇒ Script Sample to any object in the scene and press play. Make sure that there are no errors and that the axes and inputs are recognized in the GUI.
    • Once done, remove LogitechSteeringWheel. This script will not be needed any more (except for any future debugging if needed).
Input Provider
  • Import NWH > Vehicle Physics 2 > OptionalPackages > Input > SteeringWheelInput > SteeringWheelInput.unityasset by double clicking on it in the inspector.
  • Attach the SteeringWheelInputProvider to any object in the scene. Make sure that there is only one InputProvider of type SteeringWheelInputProvider present in the scene.
  • Adjust Vehicle Source as needed.
  • Press play. Once a vehicle is entered force feedback will start working.
  • To adjust per-vehicle settings, attach ForceFeedbackSettings script to that vehicle.
Previous Next

NWH Vehicle Physics 2 Documentation

Table of Contents

  • About
  • Setup
  • Input
  • Vehicle Controller
  • Wheel Controller
  • NWH Common Scripts
  • Trailers
  • GUI
  • Multiplayer
  • Render Pipelines
  • Add-ons
  • FAQ
  • Troubleshooting
  • Demos
  • Changelog
  • Upgrade Notes
  • Support