Showing posts with label unity 3d tutorial. Show all posts
Showing posts with label unity 3d tutorial. Show all posts

Thursday, 30 May 2013

Unity3d Car Game Tutorial-8 (Adding AI Cars)

Due to some reason I cannot continue making videos on Unity Car Game Tutorial Series, however I will be writing posts on it instead, hope you will appreciate the posts as you did for the videos. So let's kick off then.

In this bit of the tutorial we will be adding AI Cars to our game. Follow the steps below carefully and you shall be successful in adding AI cars and make the race game more enjoyable.
(Try to use a track which is flat and does not include up's and down's, like in the unity3d demo project)

Step 1: Drag the Car transform from the 'Project' section into the 'Hierarchy' section and name it as (say)           'AICar' (Search for 'car' in the 'search' bar in 'project' section)

Step 2: Create a Javascript named AICar_Script and add the code from the link here

Step 3: Replace the 'Car' script of the 'AICar' with the AICar_Script script

Step 4: Now create WheelColliders for the rest 3 wheels as well, as we had did it earlier for the Front Wheel (Simply duplicate WHeelFL by clicking on it once and pressing 'ctrl+d' and rename them as 'WheelFR', 'WheelRL', 'WheelRR') and synchronize them with the 3 wheels (the two images below should help in clearing doubts, if any).















Step 5:  Now drag the wheels and the wheelcolliders onto the hierarchy as in the image below





Step 6: Go to GameObject and create an empty Gameobject and rename it as 'WaypointContainer'

Step 7: Go to GameObject -> Create Other -> Sphere and create a sphere, and move it onto the WaypointContainer gameobject, and place the sphere on the terrain as if it is just kissing the surface, this is our first waypoint.

Step 8: Create waypoints like this all along the way, so that your AI car follows the waypoints (more the waypoints, better the result.) The Images below might help in clearing this point (The spheres or the small dots you see in the image on the right are the waypoints)












Step 9: Now drag this WaypointContainer onto the Waypoint Container of the AICar_Script as shown in the image below





















Step 10: Set the Gear Ratio to the values shown in the image above.

This is it, if you have followed this post correctly then you should have an AICar in your race game.
You can follow the same steps to create more AICars.

Hopefully this post is clear and hope this helped you, comment if you have any issues.

Saturday, 4 May 2013

Unity3d Car Game Tutorial-7 (CREATING LAP AND CHECKPOINT SYSTEM)

In this bit of the tutorial, we will add Laps and Checkpoints system to our car racing game.


Refer to the videos below for more details.






The scripts used can be downloaded below:
Checkpoints
CarCheckpoint
Timer


This is it for the Part-7 of this tutorial series. We'll learn more in the following posts.
Comment if you have any queries.


Friday, 19 April 2013

Unity3d Car Game Tutorial-6 (Saving Best Time using PlayerPrefs)

In this bit of the tutorial, we will learn how to use the PlayerPrefs to save the Best Time taken to complete the race and also save the Name of the player who completed the race in the respective time and display it on the screen.

Refer to the video below for more details.






The timer script used here can be downloaded from the link below:
Timer


This is it for the Part-6 of this tutorial series. We'll learn more in the following posts.
Comment if you have any queries.

Wednesday, 17 April 2013

Unity3d Car Game Tutorial-5 (Speed Indicator)

In this bit of the tutorial, we will learn how to add a SPEED INDICATOR to the game screen.

Refer to the video below for more details.







This is it for the Part-5 of this tutorial. We'll learn more in the following posts.
Comment if you have any queries.

Thursday, 11 April 2013

Unity3d Car Game Tutorial-4 (Stop the car after it reaches finish line)

In this bit of the tutorial, I will show you how to stop the car once it has crossed the Finish Line.


Refer to the video below for more details.

Car Game Creation Tutorial using Unity3d-4... by gluedbrain





This is it for the Part-4 of this tutorial. We'll learn more in the following posts.
Comment if you have any queries.



Unity3d Car Game Tutorial-3 (Finish Line)

In this bit of the tutorial, I will show you how to make a Finish Line to our race and stop the timer once the car has reached the finish line.

Refer to the video below for more details.

Car Game Creation Tutorial using Unity3d-3... by gluedbrain





You can find the code used in the above video below.
Timer


This is it for the Part-3 of this tutorial. We'll learn more in the following posts.
Comment if you have any queries.

Unity3d Car Game Tutorial-2 (Timer)

In this bit of the tutorial, I will show you how to setup a Timer to keep track of the time past.

Refer to the video below for more details.


Car Game Creation Tutorial using Unity3d-2 TIMER by gluedbrain


You can find the code used in the above video below.
Timer
Countdown


This is it for the Part-2 of this tutorial. We'll learn more in the following posts.
Comment if you have any queries.


Unity3d Car Game Tutorial-1 (Countdown)


Hello unity users, I'm starting a new car game tutorial for you all. I'll use the car game demo from the asset store as our reference instead of building it from the scratch.

So lets get it started then.

In this bit of the tutorial, I will show you how to set a countdown, so as to give a racing game feel.

Refer to the video below for more details:

Car Game Creation Tutorial using Unity3d-1... by gluedbrain



You can find the code used in the above video below:
countdown
This is it for the Part-1 of the tutorial series. We'll learn more in the following posts.
Comment if you have any queries.