Sunday, 28 February 2010

Applying the Car Tutorials PT 2

+Another thing I noticed was that the buggy itself was leaning to the left, as if it had a puncture. I suspected that this problem may have lied with the wheel colliders not being configured properly. Sure enough, by adjusting the radius of the wheel colliders, as well as repositioning the colliders so that they were in the dead centres of each wheel, the buggy became level again.

However, the buggy would still fly all over the place, and was prone to flipping over if it took a turn to sharply. To try and find a fix to this, I once again consulted the tutorial on the website. It was here that I noticed the following paragraph:

"I would not recommend changing the asymptote values until you know exactly how they work, it’s much easier to change the “Stiffness” value. This is essentially a multiplier for the curve, when set lower, it decreases both values linearly. You will want this value set fairly low, generally less than 0.1 if you want your car to slide nicely. If the sideways friction stiffness is set too high, you may have some stability issues, the car will stick to the road so much, that when you try to turn at high speeds, your car will quite literally roll off into space."

As it turns out, I still had the stiffness values of my wheel colliders set to the default value of 1. By reducing them down to 0.1, I not only noticed that my car was a lot more stable when driving around, but also that it moved at a low slower speed.


Friday, 26 February 2010

Applying the Car Tutorials

Slightly behind scedule but I've finally made a start to the Unity project. The first stage is to set up a new project and scene. Once this was done, I imported the .blend file of my Dune Buggy model directly into the scene. However, after the model was imported and I dragged it into the scene, the main body of the buggy was out of position. After some rotating, the dune buggy was looking as it should.












After working my way through the tutorial at http://www.gotow.net/andrew/blog/?page_id=78 with my dune buggy model, I needed to import some assets into my project from the website (such as sound and the wheel slip prefab). After I was done with the tutorial, I added a plane below my dune buggy gameobject and previewed the scene. The first thing I noticed was that the camera was looking at my car side on, but the car was successfully driving around on the plane (albeit I couldn't see where I was going).

I had a quick look on the tutorial website to see if anyone had mentioned the problemed but no luck. To fix this problem, I dabbled into the camera 'smooth follow' script myself. A method I found that worked was switching the x and z co-ordinates at every instance in the code. After once again compiling the scene and running the game, I found this did the trick. However, after viewing it from the correct perspective, I noticed a few other glaring mistakes.

Once thing is that the dune buggy had steering problems and would fly into the air if travelling too fast, or reversing. The other more major problem is that the wheels would spin around the wrong axis (creating a most perculiar looking effect). Using a similar method to the camera, I decided to edit the script and flip the x and z co-ordinates around. Sure enough, this did the trick and the wheels worked fine.

Thinking about it some more, it seems that perhaps the x and z co-ordinates of my blender model were the wrong way around, and so unity believes that the front of my dune buggy is infact the side of it. As long as the car runs fine, then this shouldn't be too much of a concern.

Monday, 22 February 2010

Car Tutorial

Carrying on from the post before, I found the car tutorial quite useful. Although some of the coding was already done at the start, the tutorial consisted on setting up a car gameobject, and attaching scripts to control car movement, sound and getting the camera to follow behind the car.

However, the tutorial did not contain any tutorial on setting up wheel colliders, as my dune buggy has a chassis that is considerably different to the one used in the tutorial. No major problems with this tutorial either, but did require a lot of time and effort to set everything up.




































Near the end of finishing the tutorial, I came across another car Unity car tutorial at the site:

http://www.gotow.net/andrew/blog/?page_id=78

The good thing about this tutorial is that it seems a lot more customisable than the other, so that I'd be able to get a good setup for a dune buggy type car. The tutorial also seems to get more to the point about making a car setup, since the one I previously completed relied more on setting up aspects such as sound effects and lighting/shadow.

Saturday, 20 February 2010

Starting the Car Mechanics

Now that I am making the track in the Unity engine instead of blender, I made the decision to push back the track modelling and instead focus on getting a car driving around first. My first bit of research took me to youtube, where I searched around to see if any other projects existed which were similar to mine, using the Unity engine.

One set of clips caught my particular attention, posted by the user 3Dnemo who has a website at www.3dnemo.com. His videos consist of various racing games made in the unity engine, some which are quite similar to the outcome I plan on achieving (which I have posted below).

http://www.youtube.com/watch?v=sR8UWWjrskg
http://www.youtube.com/watch?v=XSmDEC1dWPM

Despite having a tutorial section on his website, there is unfortunately not one for setting up a racing car project. After looking at some examples of racing projects done in unity, I began looking for some car tutorials in which I can base my work on. The first one I came across was posted on the unity3d website (http://unity3d.com/support/resources/tutorials/car-tutorial). My results from this tutorial will be posted in a few days.

Tuesday, 16 February 2010

Wait, Unity has a level editor?

After having many problems with trying to get my track model implemented into the Unity engine (mainly due to collision detection problems and exeedingly high framerates, probably them trees), I discovered that Unity has a build in terrain option where it is extremely easy to make terrain that can be made directly in the engine.

Luckily, my track model was not finished yet (the last model that needed to be done) so it's not a complete loss, but a lot of time has been wasted in modelling the track which could have been used elsewhere.

I had a quick go in the unity terrain editor and the whole process is less time consuming than making terrain using blender (although it may not be as customisable). Previewing the terrain using a simple camera set up also had a big impact on the framerate. I was able to have a lot of trees, bushes and grass in the scene and was still achieving comfortable framerates (60+ FPS).

Sunday, 14 February 2010

Unity Tutorials (Part Deux)

After I had completed the first tutorial (GUI essentials), I moved onto the next tutorial provided in the Unity documentation (called Scripting Essentials). The tutorial consisted of writing a javascript to make a light source target the First Person Controller, as if it were a moving spotlight. If the space bar is pushed, the target of the spotlight would change from the controller to a cube in the middle of the plane.

The second part of the tutorial involved writing a script that would instantise a cube prefab whenever the left mouse button was pushed, and setting its position to the current position of the First Person Controller.

Again, the tutorial was rather easy to work through, since using Unity is much easier than performing a similar process in XNA Gamestudio. The only major problems were getting the code right, but any mistakes were shown in the error log. The results can be seen below.

















Thursday, 11 February 2010

Unity Tutorials

Before going ahead and starting the development of the game, I first wanted to get to know the Unity interface together. To do this, I read through the Unity Basics guide as found in the Unity Manual. Once I had a brief understanding of the Unity interface, I proceeded to work through several tutorials explaining the basic functions of the Unity engine and GUI.

The first tutorial which I completed was the tutorial 'GUI Essentials' which is found in the provided documentals. Working through the tutorial, I was relatively comfortable with how things are done in unity, and the fact that the game view is updated in real time it a nice feature.

The tutorial itself consisted of creating a plain, with a cube placed onto it. The cube was then duplicated several times to form a stack,slightly scewing them so that the stack would fall over. Also, a first controller was added so that the player can navigate the plain, interacting with the cubes. The results from this tutorial have been posted below.

















Friday, 5 February 2010

Sound

Had a quick look at sounds to use in the game. The songs I was thinking of implementing for the menu screen is 'Steppenwolf - Born to be Wild' and 'ACDC - Highway to Hell', since both are related to driving. They can be seen below.

http://www.youtube.com/watch?v=xm5DPlNCmtk
http://www.youtube.com/watch?v=a5BjIVS04jk

Tuesday, 2 February 2010

2D Images

Been working the past couple of days on the images I need for the game, mainly the title screen, menu screen and the HUD. The image from the title screen is a picture of the game 'Sega Rally' and the font is 'Car-Go' . The faded black bar need the bottom is just a black rectangle with Gaussian Blur and the opacity adjusted.

For the HUD, I started with an empty (background) and searched on the internet for some 'splat' brush add-ons for photoshop. I then experimented with different paint splats to see which ones worked the best, before placing them in the desired location. The 'health' symbol was taken from the site http://www.lynncamtv.com/assets/images/health_symbol.jpg, and inverted so that it was white. All images can be seen below.