Você está na página 1de 6

Driving Game

Create a plane and scale it


by 50 in X, Y and Z
I added a red tile material
to give it colour and texture
Scale it up


























Added some cubes to drive
around (create one the
copy and paste more)
Using a cube and 4 cylinders,
Create a car at roughly co-
ordinates 0,0.5,0
Create an empty game
object to house the car
components.
Put it in roughly the same
location (0,0,0)
Rename it as vehicle (or
whatever you want)
You can now drag the car parts (plus
others we are going to make) into the
vehicle placeholder. They are then all
treated as one object.























With the lighting selected
change the render mode to
important to stop Unity
phasing it down to retain
performance.
Adjust the shape of the
cone of particles

And drag it into the
vehicle object.
And adjust the camera so you get a
decent drivers view.
Include the camera in the vehicle group.
Use a particle system for
sparkly particle exhaust gasses
































Now to get the car to
move using javascript
Create a javascript
script
Call it movement
We want to create a rotation
around the Y axis by detecting the
left/right (horizontal) arrow key
press and applying a value
Delete the existing code and write
this.



























Attach it by dragging the script
to the Inspector for the vehicle
object.

Test it to make sure it works.
Pressing the arrow keys should
make it rotate
To make the forward motion
realistic apply physics. Make
sure the vehicle is selected and
apply the Rigidbody object.
Add the extra
lines to access
and alter the
rigidbody
object






/www.youtube.com/watch?v=VV3sSM0gjQ8

Alter the
rigidbody
values to make
it more
realistic

Você também pode gostar