- Home /
Aiming down sights
I am working on an fps that is pretty much done and i am now just working on details, one of which is accuracy. i want to have bullet spray while shooting but when aiming down the sights of your gun spray is reduced. i am relatively new to scripting (for more of the complex stuff i used assets from the site) and i was wondering if anybody could help me with it?
p.s. sorry its so long hehe
Answer by jester · May 20, 2010 at 02:40 AM
this was asked and answered in this forum thread: Vector rotation
using that as an example, and the initial assumption that your gun site is looking down the positive Z axis, you could take your vector that represents the gun site and rotate it by some small random amount around the X and Y axis. use those random amounts to make quaternions and muliply those two quaternions against the vector that represents the guns aim. that would represent the random spray of bullets around the gun site aim. if the player is in aimed mode, you could reduce the random numbers so that the spray is closer to the true aim.
i haven't messed with the fps tutorial, but there should be a fairly easy way to get the two vectors you need. you can probably use Vector3.up as one and then use the Vector3.Cross() function to get the other vector to rotate around.
this was very helpful regarding spray but i was also wondering if you could help me with a script allowing the player to look down the sights... like have the camera move up and look more directly down the gun sight etc. thank you for your help :)
do you mean like the player is looking through a gun site? you can use a second camera that is disabled until they enter aim mode. place that camera slightly forward of the main camera and maybe change its field of view to get a slightly different effect. you could also attach a plane to the camera and give it a black texture with a circular centered alpha channel to restrict the view to a circle to give the effect of looking through a gun site.
Answer by Pysassin · Jan 12, 2013 at 12:43 PM
If your new to coding and your making a fps I strongly suggest the EteeskiTutorials on youtube. They start you off with nothing and assume you have no scripting knowledge and at the end you have a fully functional fps prototype. Here is a link to the playlist.
I personally really like ETeeski Tutorials on Youtube. He explains everything in a really simple manner.
Answer by Andrei · Jun 11, 2010 at 02:20 PM
I do not get it, I am having the same problem. Could you explain simpler what to do
Answer by TaigaStudios · Jul 08, 2010 at 08:04 AM
This weapon tutorial has (almost) everything you need for making your own weapons Dastardlybanana. (Includes low poly weapon models and sounds)
Dastardly banana tutorial does not work on windows 7.
Your answer
Follow this Question
Related Questions
Aiming Down Sights Problem 2 Answers
FPS Gun Recoil (Accuracy) 1 Answer
Gun accuracy with Random.Range? 1 Answer
Rifle Accuracy w/ Rotation 3 Answers
How to Implement First Shot Accuracy? 2 Answers