NWH Vehicle Physics 2
This page covers the integration of NWH Vehicle Physics 2 and Game Kit Controller
Last updated
This page covers the integration of NWH Vehicle Physics 2 and Game Kit Controller
Last updated
NWH Vehicle Physics 2 is a complete vehicle simulation package for Unity. Realistic, easy to use, and heavily customizable.
• Easy and fast to set up with all the defaults loaded automatically and a validation system that warns the developer about any setup issues.
• Vehicle setup wizard that creates a functional vehicle from scratch in a few clicks. Multiple presets are available.
• Modular vehicle architecture. Enable or disable parts of the vehicle as they are needed, either manually or through the built-in LOD system.
• Powertrain solver that features excellent performance, stability, and physical accuracy.
• Custom physics sub-stepping solution.
• All aspects of the vehicle are adjustable at runtime - including powertrain, suspension, friction, effects, etc.
You can find more information about NWH Vehicle Physics 2, and its documentation and also purchase it over on the Unity Asset Store.
Open the scene Racetrack in NWH or drop the vehicle prefab you want, drop the GKC player and the rider system object prefab directly inside the vehicle.
If the default controller of NWH is on the scene, disable it. Disable all the camera objects from the vehicle, including their audio listener and the camera component of the first camera.
Drag the External Rider Controller System into the scene from the GKC folder and reset it's position. Enable the option on the GKC Rider System to Use Event On Start Game and configure the sleep function of the vehicle controller component by dragging the root prefab into the Event Field. Select VehicleController < Sleep().
Configure the events to wake and sleep on the electronic device components by dragging the vehicle prefab to Event on Start Using Device and selecting VehicleController < Awake. and Use Event on Stop Using Device and selecting VehicleController < Sleep.
Assign the DemoUICanvas (only for the Demo Scene) and set it to GameObject < Set Active and enable it.
Create a new GameObject inside the Vehicle Camera in the Cameras gameobject of the vehicle and name it Camera Position. Select the External Rider Controller System, the Move Camera to Device component and in Camera Position, assign the Camera Position gameobject you just created.
Change the Device Name and Device Action on the Device String Action component to what you want. And all is configured to work properly, now it is a matter of adjusting the IK positions and the seat and passenger elements.
Also, move the Steering gameobject from inside the External Rider Controller System object to the vehicle mesh. Make sure to unpack the prefab on the rider object. On the vehicle controller, you can adjust the steering wheel max rotation angle so it looks proper with the driver's hands on it through IK.