We were informed that we are going to make a basic space shooter game that resembles Asteroids, it will teach us the basics of Unity and we are allowed to move forward on the online tutorials to produce a more complicated game.
Before we could start anything it's always good to know how to move around on Unity
- Hold the right mouse button to enter Flythrough mode. This turns your mouse and WASD keys (plus Q and E for up and down) into quick first-person view navigation.
- Select any GameObject and press the F key. This will center the Scene View and pivot point on the selection.
- Use the arrow keys to move around on the X/Z plane.
- Hold Alt and click-drag to orbit the camera around the current pivot point.
- Hold Alt and middle click-drag to drag the Scene View camera around.
- Hold Alt and right click-drag to zoom the Scene View. This is the same as scrolling with your mouse wheel.
We also learnt shortcuts to position GameObjects; so this includes scale, rotation, and position.
Plus we learnt the basic windows of Unity:
- Scene – Where you build your game, placing and positioning all of your assets.
- Game – Your game viewed from your in game cameras and how the final game will look.
- Hierarchy – All of your game objects currently in the scene.
- Inspector – The properties of the asset or game object you have selected.
- Project – Where all of your assets are displayed that belong to the current project, it is linked to your file structure in windows explorer or mac finder.
- Console – This is where error messages and certain information is printed.
- Assets – Files such as textures, 3D models or scripts that can be used within your game.
- Game Objects – In game containers that are used to store the properties of your assets.
- Components – The individual properties that make up your game object.
Setting up the project
Initially the Build Target had to be changed, currently the game was going to made for PC/Mac/Linux which is not what was wanted, it should be set to Web Player.
This was done by going to File - Build Settings...
And once in that window all that needed to be selected was Web Player and then click Switch Platforms to confirm and change the platform over. To check that it has switched the platform look to the side of Web Player and the unity logo should be there.
However the Game view doesn't initially show this so you have to change the view so that it's easier to see where and what you are changing in the game, it also helps you see how the game is coming along so far. It needs to be changed to 600x900 which is the same as the Web Player platform, and then it should be a vertical shot view in the centre of the Game viewer.
Game Object
To get the players ship into the game all you need to do is find it within the Assets - Models folder and drag it into the Hierarchy, the ship should then appear in the scene, we also renamed ours to "Player" so we can see what is what in the Hierarchy and keep organised. It also helps to get the ship to it's origin position so it's easier to create a game around, this can be done by going to the little gear option in Transform and clicking reset.
Next we added on a component called Rigidbody:
"Rigidbodies enable your GameObjects to act under the control of physics. The Rigidbody can receive forces and torque to make your objects move in a realistic way. Any GameObject must contain a Rigidbody to be influenced by gravity, act under added forces via scripting, or interact with other objects through the NVIDIA PhysX physics engine."
We then turned off the 'use gravity' option because that would make our ship disappear into the distance, and that is not necessary for this type of game.
We also added on a mesh collider and enabled the 'is trigger' option, this is done to make the collider trigger certain events for example if the ship crashed into another object in the game. Also we changed mesh to a simpler version of the ship, this is because the less complicated the mesh the better it is and easier the game will load instead of crashing.
Finally we added on the engine prefab, this is to make the ship look like it has fire coming out of the engines, to do this all we needed to do was drag the prefab to the ship in the hierarchy and it would instantly attach itself to the ship also making it a child of the GameObject.
No comments:
Post a Comment