- Home /
How to get the camera to hold the gun?
I'm creating an FPS game and I have the gun, and I have the camera. So how do I go about making the camera hold the gun? I'm rather new to Unity so most of the answers out there just baffle me. Maybe if you could provide a step-by-step explanation here it would be really helpful :)
Answer by donutkeith · Nov 16, 2012 at 07:19 AM
You need to add a capsule collider to your camera that way you have collision with your player and then parent your gun to the camera.
Step by step: ( The gameObject and Component tabs are at the top of the screen ) 1. Go to gameObject tab -> click create other -> camera 2. Click the camera -> go to component tab -> physics -> capsule collider 3. In the hierarchy tab drag the gun into the camera[This parents the gun to the camera]
Now when your camera moves your gun will follow and you will be able to collide with things like the floor. You can also import and character controller asset that has the code all set up to move around. Go to assets at the top import -> package -> character controller. Hope that helped.
Your answer
Follow this Question
Related Questions
FPS (sometimes) invisible gun?! 2 Answers
I want to change gun position with my camera joystick 0 Answers
How to bring reticles in different situations to the center of the camera? 0 Answers
Problem with camera and gun in FPS game 0 Answers
Which is better, shooting a bullet from camera or from the gun itself? 3 Answers