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 hugemaggot · Nov 24, 2010 at 04:39 PM · fpsgameaiming

Aiming down a gun

Ive been working on an fps game in unity for a while now and are almost finished but im not sure how to create scopes and be able to look down them if anyone noes please can you help me

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

1 Reply

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

Answer by oliver-jones · Nov 24, 2010 at 04:46 PM

Okay, This is what I do:

static var ZoomOut = Vector3(0.265012, -0.1908424, -0.7531716); //Current Position of Gun

static var ZoomIn = Vector3(0.0135, -0.12, -0.8); //Position of Zoom (trial and error)

static var Zoom = false;

function Update () { if(Input.GetButtonDown ("Fire2")) {

         transform.localPosition = ZoomIn; 
         Crosshair.OriginalOn = false;
         Camera.main.fieldOfView = 40; //Turn off crosshair



 } 

     if(Input.GetButtonUp ("Fire2"))
     {

         transform.localPosition = ZoomOut;
         Camera.main.fieldOfView = 60; //default = 60
         Crosshair.OriginalOn = true;
         Zoom = false;
     }

}

Comment
Add comment · Show 4 · 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 hugemaggot · Nov 28, 2010 at 12:34 PM 0
Share

where do i attach this script?

avatar image oliver-jones · Nov 28, 2010 at 12:37 PM 0
Share

On to your weapon. So you should have your player controller > main camera > weapon (im guessing) just drag it on to your weapon that you want zoo$$anonymous$$g in.

avatar image oliver-jones · Nov 28, 2010 at 12:40 PM 0
Share

NOTE: once you have added the script, you will need to change the ZoomOut variables to your current position of your gun

avatar image hugemaggot · Dec 03, 2010 at 06:47 PM 0
Share

when i copy the script you have given me an error comes up saying original on is not a member of crosshair

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

No one has followed this question yet.

Related Questions

Why my game's FPS drop every time I change scene (Android Game) ? 1 Answer

Main Menu Instructions? 2 Answers

multiple animations? 1 Answer

Horror Game AI script recommendation? 1 Answer

FPS Game Level Loader 0 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