- Home /
Need help with the third person shooter controller
I have developed a simple third person controller using the Newtonians' Blog 3D topic Simple Third Person Character Movement in Unity 3d (with Mecanim) - I .................I have a gun that I walk through it makes the character holds the gun in hand ...................Now I want to make the crosshair and let the character do the shooting part ...........How do I do it?????? I have used the updated mouse orbit script for the camera.
Drawing the crosshair is done using the UI.
$$anonymous$$ake a new canvas and make an image at the center of the screen that will be your crosshair.
For shooting, you need to do a raycast from the camera to the world. You need to learn how raycasts work:
http://docs.unity3d.com/ScriptReference/Physics.Raycast.html
You also need to test the hit collider's object to see if you have hit an enemy or just something in the world. You use a raycast's result for that:
http://docs.unity3d.com/ScriptReference/RaycastHit.html
Then you need to spawn visual effects and sounds when the gun fires, and maybe play new animation. You need to learn particle systems and animation states. If you want bullet holes in the world, you need to implement (or download an asset) for Decal systems.
The exact details are a lot of work, but I hope this is enough to get you started.