Creating vehicles #

This step-by-step tutorial shows how to create and configure a new vehicle from scratch in Vehicle Physics Pro. You will be configuring and rigging the L200 Pickup Truck, but you may configure any vehicle following the same steps.

Requirements
An Unity 3D project with the VPP core and sample assets (see Setting Up Vehicle Physics Pro).

Basic working vehicle #

Prepare a test scene, create the vehicle GameObject, add the basic VPP components, configure and test the vehicle.

You should now be driving the L200 in the test scene. Review the steps above carefully if something doesn't work or you get some error.

Note that vehicle dynamics are not configured at all - the car is using the default values for all components. This allows some fun driving, but the handling and behavior will be poor. The next chapter Configuring Vehicles describes everything you need to know to configure the car properly.

Configuring the VPWheelColliders manually

If the VPWheelCollider option Adjust position and radius to the Wheel mesh doesn't work in your case (step 7 above) you may do it manually:

  1. The position of the VPWheelCollider component must match the Transform's position of its assigned visual wheel.
  2. Use the VPWheelCollider's center property for moving the wheel gizmo to the outer bound of the visual wheel.
  3. Adjust the VPWheelCollider's radius for matching the radius of the visual wheel.

Wheel collider positions #

You may notice that the car experiences sudden bounces when touching other objects sideways. This is caused by the wheel colliders being outside the vehicle's collider.

The option Adjust position and radius to the Wheel mesh (step 7 above) places the wheel collider at the outer bound of the wheel. This position provides the best stability (larger wheelbase). However, it's important that the top half of the WheelColliders remain inside the vehicle's collider for avoiding the described effects. More information on vehicle colliders.

Check out the description of the issue and possible solutions below. Choose one of the solutions and apply it.

Adding and configuring effects #

Now let's configure the basic audio and visual effects by adding add-on components to the vehicle: Telemetry, Audio, Tires, and Driver's View.

Add-on components in Vehicle Physics Pro

VPP add-on components don't need to be necessarily at the vehicle's root GameObject. These components may be added to children GameObjects as well. You may arrange several add-on components in different GameObjects of the vehicle, enable disable them at your will, and even create and dispose them in runtime.

You may Play the scene after each step for testing how it works.

Other visual effects #

The L200 3D model is not prepared for further visual effects. In your vehicles you can add a VPVisualEffects component for:

Check out the VPP JPickup vehicle in the scene Getting Started - JPickup for learning how this component works.

You can now head to the Vehicle Setup Guide for configuring the vehicle dynamics (center of mass, engine, brakes, etc).