Skip to content
This repository has been archived by the owner on Jun 15, 2019. It is now read-only.

angelotadres/AICar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AICar

A little project to learn about wheel colliders an AI in a Unity 3D Car. The goal is to resolve all the challenges.

(I created this project to train engineers at DeNA Vancouver.)

Requirements

This project was tested with Unity 5.2.

Instructions

  • Download the project.
  • The folder Challenges has the scenes for each Challenge.
  • You need to proceed in order and reuse part of the code you will generate.
  • All the resources for the challenge are provided in the folder content.
  • Use the links for the next slide to get the information needed to complete the challenges!
  • Good Luck :)

Resources

Wheelcollider:

Rigid Body:

Raycasting:

Use Youtube… a lot of material is there :)

Challenge 01 - Part 1

Goal : Create a basic car and move it using Wheel Colliders

  • Open the scene Challenge1
  • In the center of the scene you will find a basic 3D model of a car. The chassis and the wheels are independent objects.
  • Using Wheel Colliders create a Monobehaviour to control the car movement using the arrow keys.

Hints:

  • You will need a Rigid body for the chassis. Adjust the physical parameters like Mass or Center of Gravity to improve the stability of your car.
  • The motorTorque could be calculated like : EngineTorque / GearRatio * Input.GetAxis("Vertical");
  • If you want to simplify the equation, assume your car only have one GearRatio, and this is equal to 4.31f;

Challenge 01 - Part 2

Goal : Explore properties of Wheel Colliders and Pimp Your Ride!

  • Continue working in the scene Challenge1
  • Make all the wheels rotate in the direction of the movement.
  • Rotate the front wheels every time the user turns to left or right.
  • Add Slips to your Wheels (check the prefab folder)

Optional:

  • Pimp your Ride, change the chassis and add your custom one!
  • Explore the Wheel Colliders Suspension Spring parameters… Create a Low Rider!

Challenge 02

Goal : Make the car move alone

  • Grab the car you created on the Challenge1 and create a prefab with that.
  • Open the scene Challenge2, you will see and empty scene with a plane.
  • Copy the car prefab in the scene.
  • Create an empty GameObject called WayPoints
  • For the prefab folder drag the WayPoint prefab inside the GameObject you created, generate several copies and create a circuit (you will see something similar to the left image, several cubes united by lines)
  • Define one of the WayPoints as a starting point.
  • Based on the original behaviour you used for your car, do the modifications to make the car navigate alone using the Waypoints.
  • Change the place of the Waypoints to see how your car performs.

Challenge 03

Goal : Make the car move alone and avoid obstacles

  • Grab the car you created on the Challenge2 and create a prefab with that.
  • Open the scene Challenge3, you will see and empty scene with a circuit of Waypoints and obstacles.
  • Copy the car prefab in the scene.
  • Based on the original behaviour you used for your car in the Challenge2, do the modifications to make the car navigate alone using the Waypoints and also avoid Obstacles

Hints:

  • Use Ray cast to see what is in front of you.

About

A little project to learn about wheel colliders an AI in a Unity 3D Car.

Resources

Stars

Watchers

Forks

Packages

No packages published