Hi in this unity tutorial I will go over three ways I found to move a car for a video game.
1. Car Physics - like moving a block plain and simple
2. Car Raycast - move a block suspended above ground using raycasts. A little more bouncy
3. Car WheelCollider - use Unity's wheel colliders and simulate car physics the most realistic out of the three.
I personally like raycast method as the most fun to drive around.
Source Code: https://github.com/omarvision/3WaysTo...
Playable Demo: https://simmer.io/@Omarvision/3-ways-...
0:00 introduction
2:00 The video starts by explaining the first method of moving a car in a Unity game - using physics to control a simple cube object as the car.
9:14 The second method discussed is the "physics car" approach, where the car is a more detailed model with separate wheel objects attached to anchors.
18:14 The script for the physics car is explained, including how it handles turning, moving, braking, and spinning the wheels realistically.
31:27 The third method is the "raycast car", which uses raycasts to detect the ground and apply suspension forces to the car rather than using colliders.
40:02 The script for the raycast car is discussed, focusing on how the suspension is implemented using the raycast information.
49:08 The final method covered is the "wheel collider car", which utilizes Unity's built-in wheel collider component to handle the car's physics.
53:30 The script for the wheel collider car is explained, highlighting how it uses the wheel collider component for turning and moving the car.