- Home /
Extend Unity5 FPSController or start from scratch?
I'm making a FPS game that needs a gun with zoom, reload and fire animations, jumping/crouching, etc.
Is the default FPSController a good place to start, and extend the FPSController with some custom scripts?
I see other users creating a Capsule and attaching all the custom movement scripts to it: example: https://www.youtube.com/watch?v=fAUmoa1a0-U
example: https://www.youtube.com/watch?v=blO039OzUZc
My concern is that the FPSController that comes with Unity5 might not be easy to extend, even though it's pretty robust.
Some of the functionality I need:
Gun that stays in the camera view
Weighted gun movement (gun moves around slightly when looking around)
Zoomed view down the scope
Crouching
For those who have been down this path already, what would you recommend, extend FPSController or DIY controller?
***EDIT:
Thanks for all the collaboration guys, I really appreciate it.
I have been investigating the various strategies to make a good FPS controller with animations, etc. I figured this is such an important part to having a fun FPS that I wanted to make sure I didn’t go down the wrong path up front. After digging through lots of free resources, I have found a couple key points compiled here.
TL;DR: Make a simple Controller first, then extend the UnityFPS controller once you understand what’s going on, finally look into buying a prefab once you know what to look for and what you’ll need in your game.
There really isn’t a “right” way to do anything because there are so many ways to achieve similar functionality/look in the FPS.
There are many FPS-ready packages available for download that do a lot of the common tasks like handling movement, weapon animations, and various other functionality you may or may not need. The most popular FPS is probably UFPS which is a pretty heavy package (also $80) that does a TON of stuff you will eventually need in your FPS. Their “secret sauce” with how fluid it all looks is by using procedural animations (a spring system that “pushes” and “dampens” forces from player input and movement:https://www.reddit.com/r/Unity3D/comments/3tg6ov/using_perlin_noise_and_other_procedural/, you can read about it here: https://docs.google.com/document/d/17Ns3PwlSWg4kqWwnBZ4DRa9n_LMSOe7m3KzMfsPUGBI/pub?embedded=true#h.69r4j1rrvafw
If you are interested in making your own FPS or using another FPS package, I would first make a simple FPS controller from scratch from the many tutorials online first. Once you know how to make a very simple FPS, you can start to think about how complex you want your animations to be and your skill level. Sometimes pre-made FPS controllers may seem like the right choice at first but then you quickly hit limitations with how they are implemented and don’t have an easy way to extend…in which case it would have been better to just start your own from scratch.
There are several items that really add a nice feel for a FPS weapons, like gun sway (the movement of the gun as you look around and move around), bobbing (slight gun bob when you are idle, head bobbing when you walk etc), Depth of field/Blur on movement effects (these are easy to implement).
Let me know if you are interested in making your own FPS controller and I’ll see if I can throw something together on youtube.
Here are the best tutorial resources I found along the way:
Create Multiplayer FPS from scratch (2014, 3 part series from Unity): https://unity3d.com/learn/tutorials/topics/asset-store/merry-fragmas-multiplayer-fps-part-1
- Teaches you the basics without getting bogged down with all the nice “polish” features that take 80% of your time but only add 20% value.
The guy is a great teacher and doesn’t go too fast or slow.
Multiplayer included!! (Most tutorials i found don’t go from start to actual multiplayer)
Only uses one paid prefab for a muzzle flash, not necessary to complete the tutorials though.
- Teaches you the basics without getting bogged down with all the nice “polish” features that take 80% of your time but only add 20% value.
Create a simple FPS controller (2016): https://www.youtube.com/watch?v=blO039OzUZc - The gal is a GREAT teacher. very clearly explains the concepts. awesome British accent. - Part of a paid series on Udemy. Probably worth buying. - Short video (only 20 minutes)
Another DIY FPS Controller (2014, 3 parts) https://www.youtube.com/watch?v=qJTwJBYMGWg: - A young fellow teaches, he’s pretty entertaining and seems to know what he’s doing. - Discusses topics like shooting, bullet fragments, bullet holes on walls, aiming down the sight, etc. - Gets you started but doesn’t seem to have a cohesive tutorial series, missing parts from part 2-3.
Getting started with the Unity FPSController (2015): https://www.youtube.com/watch?v=NIAw9RHGUkM - Short video with quick explanation.
Getting started with UFPS: https://www.youtube.com/watch?v=YyCl_Xg4mxM - Gives you a good preview of what UFPS offers if you want to go that route.
Using Blender to import guns and animations: - https://www.youtube.com/watch?v=ckLA93LrMQs https://www.youtube.com/watch?v=qyrw61A3E94
Other resources:
Adding Depth of field: https://www.youtube.com/watch?v=UECZPVXDXnA (Unity has a pre-made Depth of field effect!)
Adding Zoom: https://www.youtube.com/watch?v=4XDdM3PozZQ (it just modified the Field of view)
Adding Gun sway: https://www.youtube.com/watch?v=mwPIN8Nx3-U (this is the “easier” way i found, moderate complexity script)
Aiming Gun view: https://www.youtube.com/watch?v=L9AevDnLce4 (simple script)
Models/Packages I found along the way:
BattleOfUnion FPS guns: https://www.youtube.com/watch?v=dey56q98kYo
RealisticFPS Prefab Package: https://www.assetstore.unity3d.com/en/#!/content/7739
CZ805 (BF4 gun), nice animations: http://tf3dm.com/download-page.php?url=cz805-bren-a1a2-with-animation-64107
Full Character rigged model: http://www.turbosquid.com/3d-models/free-fbx-model-soldier-military-character-rigged/516949
Answer by Jessespike · Oct 05, 2016 at 07:07 PM
Depends on how proficient you are and what your goals are. If you have never created an FPS controller before and/or have a deadline, then extending the existing one might be better. If you are doing this solely for learning purposes and/or have time to do so, then go for it, write your own. All the features you asked can be extended to the existing FPS controller, but since you have concerns whether extending is easy or not, then I would suggest, start by reviewing the existing controller, and then you'll have the answer to your question.
Answer by Zitoox · Oct 05, 2016 at 11:31 PM
I would recommend you to make an entire new one, as i am going to do that too soon.
I am working in a FPS with some friends and we have the same problem: Crouching. The Standard Character is just a camera and it have a cillinder as a corpse. If you just want it to be a simple cillinder, okay. But as far as i know it is very difficult to modify it so it can crouch unless you have a full rigged character to use combined, so i recommend you to remove the cillinder as corpse and change it to a custom character OR make another character from scratch.
But in the other way, making a gun that stays in camera view isn't a script thing. Actually, it is very easy to do and you can do it with almost anything. The gun movement is pretty easy to do and the aim thing is too. Actually, i did those two things with the animator only and a simple script =]
I don't see what is difficult about crouching. Even something simple like this will work:
if (m_Crouch)
GetComponent<CapsuleCollider>().height = 0.5f;
else
GetComponent<CapsuleCollider>().height = 1.6f;
If you're talking about the cylinder being the model, then swap it for a character. Play the crouch animation when crouching, etc. The camera should be independent from the model.
Of course it isn't a problem if you are going to ROTATE the cillinder. I am saying that this might be a problem if you want to make multiplayer or something. Also, if you have any mirror in your game, players will be extremely annoyed if they don't have a body.