Well, that was five minutes well spent!
In the last post, I mentioned moving the ship’s physics code into the BaseShipProperties class (I think it’ll better called ShipController, don’t you?), and it’s liberating! I’ve made the main input handler smaller – a good thing, because I think we’ll be adding more to it. This allows us to easily use the same ShipController as an AI bot, sending it thrust, roll, pitch instructions without replicating the movement and intertial dampner calculations. Also, I don’t care to know what the max speed is in the camera controller, that’s upto the ship, so I don’t Clamp() it here.
Whilst I was testing my scene, I thought I’d have a look at the stats tab, and wow, 30 draw calls (aka SetPass)? I narrowed this down to the OnGui() function which had all my scene buttons in it created by GUI.Button(). Removing the buttons reduced the draw calls to 9. Much better. #oneToWatch. The funny side of this is that I had noticed juddering, so I looked into the draw calls to see if something strange was happening. Then I noticed the GUIText() culprit, but even then the program was juddering. WHY?
Well, I was running another windows 10 hyper-v session in the background that I’d forgot about. This dell laptop is amazing with its NVIDIA GeForce GTX 960M, but I should give Unity a fighting chance!
As you may notice below – I’ve found some cool font to show in HUD, maybe it’s temporary, but maybe not! It’s pretty nice. http://www.fontspace.com/nimavisual/moonhouse. Let’s hope meters per second is enough. Or do you like miles per hour? I guess it depends if my ancestors have pillaged your country or not.
Oh my, particles are fiddly beasts aren’t they? My first outing with the particle system, and I think I only achieved this by copying the standard Asset for the aircraft jets, and tweaked it a little. I think I need to spend a good few hours watching tutorials and playing around to get effects combined that produce something lovely, I’ve managed this so far – next step to make the length adjust with the speed (madness in space, it makes no sense!). The question is, should I add jets for rotation, pitch and reverse thrust? Maybe overkill.
Hmm.. The choices you have – does the jet size relate to how much you’re trying to accelerate or thrust? That would certainly be the case in the real world of space physics. But it doesn’t work so well in games. It will mean that if we are going our top speed we will have no jet. So, maybe we’ll do a bit of both. The jet should depict how hard we are trying, and as we reach our target speed, we settle down to a size proportionate to our speed. – I’ll give that a go and see! Oh the fun!