Setup a Vehicle from Scratch
Last updated
Last updated
Create a new scene and open it
Create a new 3D Object -> Plane and set the following values
If no Ground Layer exists in your project, create it
Create a new Game Object and add a Vehicle component. Set the Ground Layers to "Ground"
4. Drag and drop the car model from Assets/Ilumisoft/Arcade Racing Kit/Example/Models/Kenney Racing Kit/Racing Car onto the vehicle
5. Select the four wheels, add a sphere collider to them and set the Physics Material to Wheels
Setting the Wheels physics material is very important, otherwise the vehicle will not be able to move
Create a new Game Object, name it Vehicle Camera and attach it to the vehicle
Add a Vehicle Camera component to the Game Object
Select Cinemachine->Create Virtual Camera and attach it to the Vehicle Camera Game Object
In the Vehicle Camera component, set the VmCam field to the created virtual camera
Set the virtual camera inspector fields to the values in image 3.5
If the Virtual Camera is not positioned behind the vehicle after setting up the values, disable the game object, reset the transform, and then reenable the game object
Congratulations! You have created a basic vehicle from scratch. When entering playmode, the vehicle should be able to drive properly and the camera should be following up.
We created all vehicle scripts to work in a very modular way. With the basic setup, you can extend the vehicle further by adding a custom center of mass, effects, audio and UI. To see a complete example, take a look at the example scene.