Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Andrew Sander · May 20, 2010 at 12:36 AM · fpsgunaimingaccuracysights

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

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

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.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Andrew Sander · May 20, 2010 at 09:34 PM 0
Share

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 :)

avatar image jester · May 21, 2010 at 07:50 PM 0
Share

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.

avatar image Andrew Sander · May 27, 2010 at 01:49 AM 0
Share

Thank you very much for your help!

avatar image
1

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.

http://www.youtube.com/playlist?list=PL7AE076AFAFD3C305

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image faizanabrar1 · Oct 25, 2015 at 03:39 PM 0
Share

I personally really like ETeeski Tutorials on Youtube. He explains everything in a really simple manner.

avatar image
0

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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)

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image superpentil · Aug 29, 2010 at 11:33 PM 0
Share

Dastardly banana tutorial does not work on windows 7.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges