Rigging the Car
Build 2 was delayed by about 1 - 2 weeks because an enormous problem had occurred with getting my car to move in Unreal Engine 4. I spent day after day posting on EPIC forums as well as Reddit for assistance to no avail. It was not until I came to a YouTube video with less than 100 views, describing how to fix a major problem with exporting cars from Maya. Basically, even though FBX files can be exported out of Maya with Z as the up axis, it does not read in the same logic that Unreal does. By default, Maya reads models with a World relative orientation, while Unreal reads it as an Object relative orientation. Once that option is switched, all the mesh pivots must be rotated so that the blue arrow (Z) is the arrow up, as show above. The vehicle also does not need to be rigged. This fixes a crooked collision box for the wheels in Unreal and gets your vehicle moving.
The boost system is rather simple. It checks if you have boost in your inventory when pressed, then proceeds to increase the vehicle velocity. If you run out of boost while holding the button, a custom event will force the player to stop using boost and prevent the player from boosting again. The event "Stop" is linked to a function that consistently checks the boost count. There is also a function that removes 1 boost point per half second.
The Shoot function fires projectiles from alternating cannons on the car. In the first screen, the function checks if the player is shooting and if there is any ammo to shoot with. Then the function checks for the last cannon that fired, asking if the last one shot was right. If it was, left cannon will fire and and mark that variable false. If it is false, the right canon will fire. Over in the projectile, it will destroy itself after being airborne for 10 seconds, or destroy itself when colliding with a solid object. There are not obstacles in this build, but there will be for Build 3.
I implemented a reset function for those pesky moments when the car would land upside down in the air. This function checks to see when you are rotated to a certain degree and if your velocity is zero, then resets your rotation and runs a command that flips the car back over.
Geysers & Ammo
Two simple item pickup scripts in order to give the player more boost and ammo.