Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 CHU · Jun 15, 2011 at 04:04 PM · cameraweaponfirst-person-controller

How do I stop my FirstPersonController weapon from moving away from the camera position when I look up and down?

Hi,

I am new to Unity and making my first FPS.

I am trying to attach my weapon to the camera so it moves around with me.

I have attached the weapon to the FirstPersonController Main Camera and positioned it so it appears on screen correctly.

The weapon follows me around the map fine and goes wherever I do, all is fine until I move the camera up or down, the gun ends up moving away from the camera the higher/lower I aim. Looking at it in the scene view, the gun moves above the position of the camera when looking up and below it when looking down (when camera is in default position and looking left and right it is fine).

I did the exact same procedure in v2.6 and it worked absolutely fine, but doing it in 3.3 (that I have just started using) I am having this problem.

It does not appear to be a problem with the weapon itself as I tried using a GameObject>Cube as a test gun and the exact same thing happened with that.

I have tried attaching the gun directly to the camera and also attaching it to an emptyGameObject and attaching that directly to the camera instead, but the same thing happens either way.

I have attached 2 screenshots, the first showing the gun appearing correctly in its default position and the second showing the gun going above the camera when looking upwards.

Any help would be greatly appreciated and I thank you in advance.

James

alt text

alt text

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

2 Replies

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

Answer by flaviusxvii · Jun 15, 2011 at 06:04 PM

My guess is that your gun model isn't centered around the origin of its local coordinate space. So when you rotate it is rotating correctly, because the gun itself is shifted in it's space.

You can check by making a cube and making another copy of the gun and putting them both at (some location.. call it 10, 10, 10).. then go see if they line up the way you'd expect.

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 CHU · Jun 15, 2011 at 11:06 PM

Thanks for the advice, I think you are right, I must have moved something at some point, as when I deleted the FirstPersonController and the gun and put them back in again everything worked fine again!

Thanks again.

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

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

HDRP Camera weapon layer 1 Answer

First person camera restriction. 1 Answer

Camera on Body going crazy 1 Answer

Camera X and Y velocity HELP! 0 Answers

Blender animation walk in unity 1 Answer


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