FatNick Makes a Game: Part 3

(Part 2)

(Skip the boring stuff and go straight to the playable work in progress? click here then!)

Blimey, I’ve done quite a bit since my last update. Hurrah!

For someone who spends much of their professional life moaning at people for placing printer’s marks a fraction of a millimeter out, it was a bit embarrassing to find out that none of my wheels were actually centered properly. They were all about 0.1 out Oops. It’s amazing how much more stable something is once all 4 wheels are touching the ground!

The next part of operation ‘stop everything flipping every five seconds’ involved adding the Javascript for an antiroll bar. Was it possible? Could it be done?

I suppose the problem with Unity being so well-supported is that’s very difficult to inject any sense of jeopardy into this. Within five minutes of Googling I found this. Perfect. I like writing my own code, but I’d much prefer to learn by tweaking someone else’s, rather than reinventing the wheel everytime.

make-game

Did it work? Well, not quite. My the car was still impossibly light, so the antiroll bar alone wasn’t enough to solve the problem. Mucking around with the settings of the bar was good fun though – It turns out that amplifying the effect of the bar well beyond physical possibility wasn’t a good fix, or indeed a fix at all. Much roly-poly madness ensued. The adventage of being a hobbyist is that you can still have fun even when things are going horribly wrong,

The next thing i tried to resolve the handling crisis was shifting the center of gravity again, but in a sensible, non-cheaty way. Rather than move it down, I moved it slightly forward (to simulate an actual car with a great big whopping engine over the wheels.) This helped the handling at the front, at the expense of forcing the car to perform a destabilising-wiggle every time it attempted to steer oops.

To cut a long story short, after lots of trial and error, I finally got the car to where I wanted it to be. Instead of having the center of gravity sit slightly forward, i ended up pulling it ever so slightly backward, in order to simulate a mid engined vehicle (reckon you know what real car my physics lesson will end up being? answer now to win a prize!) I also experimented with some box colliders and a small spoiler in order to Make the vehicle a bit more balanced. As a final touch, I plugged in my Xbox controller and soon realised that the default steer had been set too high all along! Arrrgh! Once that was down everything handled swimmingly.

make-game

So with the handling where i wanted it to be for now, onto the track! After spending what felt like an age buggering around with what felt like lots of insignificant changes, creating my track was surprisingly easy. Having set up a garish orange texture, I simply dropped in lots and lots of flat angular planes.

For my test track, I wanted to create a rough homage to the Atari classic Hard Drivin’. As the iconic loop-the-loop was out of the question, I decided to borrow Atari’s bridge and banked curve. Creating the normal corners and the bridge was easy enough. I’m well aware this probably isn’t the best way to do it, but for the corners i used lots of very short rectangular planes rotated so that they appear (almost as a curve,) the bridge is a couple of planes rotated on their z axis, while the slalom is just a normal plane with some solid 3d cubes placed on it. Easy easy peasy.

make-game

The banked curve was a bit of nightmare, however. In principal it was the same as a normal curve, just with each of my segments twisted around a different axis. In practice, however, any imperfection was flipping the poor little car over. Eek. I’m interested to know what the easiest way to implement this would be – my solution was to constantly move the camera around in the scene view and make lots of TINY manual adjustments. And it sort of works, just don’t try and go round it anti clockwise. I’m 100% certain there must be a much, much better way.

So there we are, car drivable and a test track! Woo. I don’t know what game I’m creating, but at least i have an idea of what car I want to build. Woo! Want to have a go on my work in progress? Go on then. You can test it out here

(Part 4)

One Reply to “FatNick Makes a Game: Part 3”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.