- #Realistic fps prefab gun shadowing unity how to
- #Realistic fps prefab gun shadowing unity code
- #Realistic fps prefab gun shadowing unity download
- #Realistic fps prefab gun shadowing unity free
This will be the parent (or in other words: container) for the weapon model parts. Let's create an empty GameObject via GameObject-> Create Empty and name it weapon. The player only sees the upper-left part of the weapon, so we might as well leave all other sides away entirely. Our game being a first person shooter makes our lives a lot easier here. Here is how the final weapon will look like: Or we can use Unity's primitives with a few textures on them. As usual we could create a fancy 3D model, which is complicated. Now that was really easy, considering how much crazy math would be required to do that manually. If we press the Play button we can already move with the W, S, A and D keys, jump with SPACE and use the mouse to look around. It requires the player to jump if he wants to fire at higher targets. We disabled the vertical mouse-looking because it's a neat game design decision.
The first one is taking care of the horizontal mouse-looking, the other one takes care of the vertical mouse-looking. Note: there is one Mouse Look script attached to the 'First Person Controller' and there is one more which is attached to the 'Main Camera' (the one that we just disabled). Here we will change the Background color to black (choose whatever you like) and we disable the Mouse Look script: Let's select the Main Camera that is still in the Hierarchy and take a look at the Inspector. We don't need the one that was there by default, so let's delete it (the one that is NOT part of the First Person Controller, which is the lower Main Camera in our picture). One is part of the FPS Controller and one was there by default: We need to make three little adjustments to our First Person Controller.įirst off, our Hierarchy currently has two Cameras. This would be a bad position because it's outside of the level: We can find Unity's First Person Controller in our project area under Standard Assets: It takes care of all the math and allows us to add WSAD-movement with a first person camera in just a few mouse clicks. Those who ever tried to do that on their own will understand how much of an achievement Unity's First Person Controller is. Now let's jump right at the most complicated part of every First Person Shooter: implementing WSAD-movement in combination with a proper first person camera. Movement and First Person Camera Adding the Controller If you take your time you can create a decent looking level very easily. Simply start with a plane (as ground), add some cubes (as walls) and put textures on them.
#Realistic fps prefab gun shadowing unity download
While we provide the level as download for Premium members, we still encourage you to create one on your own with Unity's primitives (see the top menu: GameObject-> Create Other-> Cube/ Sphere/ Capsule/ Cylinder/ Plane). We decided to create a nice looking 3D model for our level: The LevelĪ good FPS game needs a good looking level. Note: a saved scene simply contains everything that is in the Hierarchy. Note: the Character Controller package will be used for movement and mouse looking, the Particles package will be used for explosions.Īfterwards we save it once via File-> Save Scene with the name "scene_main" (without the ""). We will also import the Character Controller and Particles packages as shown below: We will begin by creating a new Unity project via File-> New Project. We will use a lot of transparency to get the futuristic effect that we can see in the preview picture at the top of this tutorial. Our Art Style should be easy to create and yet give some nice looking effects.
We will design our game with something like Quake in mind.
#Realistic fps prefab gun shadowing unity free
We won't make use of any advanced features so Unity's free version is all that's needed. We created this game with Unity 4.5.1f3, but any newer version should do just fine too. If you already know the Unity basics then it's time for us to get started. Take a look at our easier Unity Tutorials like Unity 2D Pong Game in case you never used Unity before. This tutorial requires some understanding of the Unity basics.
#Realistic fps prefab gun shadowing unity code
We will end up with only 50 lines of code for the game (which is. But as usual Unity takes care of this for us. Now the 'movement' and 'looking around with the Mouse' parts sound like a lot of crazy math. We will focus on the following First Person Shooter elements: As usual, everything will be as simple as possible.
#Realistic fps prefab gun shadowing unity how to
In this Tutorial we will learn how to make a First Person Shooter (FPS) game in Unity.