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
2
Question by RainKiller27 · Feb 19, 2016 at 01:56 PM · firstpersoncontroller

Unity 5 new first person mouse look doesn't look up and down

I update my project to the new unity 5 and can't seem to fix the new mouse look script that doesn't allow you to look up and down only left and right how would I fix this error tried to fix it myself for that past week haven't make any progress.

Comment
Add comment · Show 1
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 meat5000 ♦ · Feb 21, 2016 at 10:18 AM 0
Share

@Rainkiller27 please dont post Questions and Comments as answers.

12 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by Torrey · May 05, 2016 at 05:05 AM

Delete Main Camera if do not need it worked for me.

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
3

Answer by Aurecon_Unity · Feb 03, 2017 at 09:00 PM

Perhaps you've solved this issue already but I just found that my FPS Controller standard asset stops allowing me to look up and down (rotate on the x-axis) when in player settings I have 'Virtual Reality Supported' selected.

In this case I wasn't building something for VR but SteamVR still kicked in when I pressed play and VR supported was automatically selected because you can now use any camera as a VR camera.

Sneaky little settings change, look out for it.

Comment
Add comment · Show 2 · 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 humam · Aug 12, 2017 at 02:59 AM 0
Share

Thankyou so much for your answer. I would have given up on this one! :)

avatar image gstarch · Mar 17, 2018 at 04:16 AM 0
Share

Thanks! This worked for me in 2017.2. I was looking in all sorts of other places.

avatar image
1

Answer by NFMynster · Feb 20, 2016 at 06:29 AM

If you import the "Standard Assets->Characters", then you'll get a FPSController prefab which should be ready to use. Edit, that script is getting its camera reference from the main camera, so make sure there is only one camera with the "main camera" tag.

Comment
Add comment · Show 2 · 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 RainKiller27 · Feb 21, 2016 at 05:51 AM 0
Share

That what I have atm, but it's only allowing left and right

avatar image wolfkillshepard · Nov 29, 2018 at 11:15 PM 0
Share

This was my problem, thank you for posting this

avatar image
1

Answer by Shykeas · Feb 20, 2016 at 10:13 AM

Please load your script in. Possibilities are it's programmed to look among Input named "Horizontal" but not Vertical. Or Vertical is there but your Unity project doesn't have such a name of an input. Etc. Either way, we can't solve an issue that we can't inspect.

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 RainKiller27 · Feb 21, 2016 at 05:52 AM 0
Share

It's just the standard asset Character. here is the code though

 using System;
 using UnityEngine;
 using UnityStandardAssets.CrossPlatformInput;
 
 namespace UnityStandardAssets.Characters.FirstPerson
 {
     [Serializable]
     public class $$anonymous$$ouseLook
     {
         public float XSensitivity = 2f;
         public float YSensitivity = 2f;
         public bool clampVerticalRotation = true;
         public float $$anonymous$$inimumX = -90F;
         public float $$anonymous$$aximumX = 90F;
         public bool smooth;
         public float smoothTime = 5f;
 
 
         private Quaternion m_CharacterTargetRot;
         private Quaternion m_CameraTargetRot;
 
 
         public void Init(Transform character, Transform camera)
         {
             m_CharacterTargetRot = character.localRotation;
             m_CameraTargetRot = camera.localRotation;
         }
 
 
         public void LookRotation(Transform character, Transform camera)
         {
             float yRot = CrossPlatformInput$$anonymous$$anager.GetAxis("$$anonymous$$ouse X") * XSensitivity;
             float xRot = CrossPlatformInput$$anonymous$$anager.GetAxis("$$anonymous$$ouse Y") * YSensitivity;
 
             m_CharacterTargetRot *= Quaternion.Euler (0f, yRot, 0f);
             m_CameraTargetRot *= Quaternion.Euler (-xRot, 0f, 0f);
 
             if(clampVerticalRotation)
                 m_CameraTargetRot = ClampRotationAroundXAxis (m_CameraTargetRot);
 
             if(smooth)
             {
                 character.localRotation = Quaternion.Slerp (character.localRotation, m_CharacterTargetRot,
                     smoothTime * Time.deltaTime);
                 camera.localRotation = Quaternion.Slerp (camera.localRotation, m_CameraTargetRot,
                     smoothTime * Time.deltaTime);
             }
             else
             {
                 character.localRotation = m_CharacterTargetRot;
                 camera.localRotation = m_CameraTargetRot;
             }
         }
 
 
         Quaternion ClampRotationAroundXAxis(Quaternion q)
         {
             q.x /= q.w;
             q.y /= q.w;
             q.z /= q.w;
             q.w = 1.0f;
 
             float angleX = 2.0f * $$anonymous$$athf.Rad2Deg * $$anonymous$$athf.Atan (q.x);
 
             angleX = $$anonymous$$athf.Clamp (angleX, $$anonymous$$inimumX, $$anonymous$$aximumX);
 
             q.x = $$anonymous$$athf.Tan (0.5f * $$anonymous$$athf.Deg2Rad * angleX);
 
             return q;
         }
 
     }
 }
avatar image
0

Answer by Eno-Khaon · Feb 20, 2016 at 10:19 AM

If you're using just the script alone, it's fundamentally based around a two-piece system.

Left and right, by its intended scheme, rotate the character around the Y-axis. Up and down, however, rotate the camera on the X-axis instead. By rotating the camera rather than the character, this prevents the character from leaning and, if physics is set to take over, falling over.

Based around that script as well, be certain that it is set in the inspector to permit rotation both horizontally and vertically, ensure that proper rotational limits have been placed on the rotation, and then confirm that it's properly connecting the script to the character's camera and not to any other(s).

Comment
Add comment · Show 2 · 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 RainKiller27 · Feb 21, 2016 at 05:57 AM 0
Share

This new mouselook doesn't allow you to connect it to the camera only the player since the mouselook is built in to the first person controller not sure if they updated it but in the mouselook script doesn't have the Y-axis anymore only the X-axis.

avatar image Eno-Khaon RainKiller27 · Feb 21, 2016 at 10:36 AM 0
Share

Hmm... Looking at your other comment, I'm not sure where the functions are being called from, but it appears that "Init()" is the first place where a camera's Transform is being utilized by the script.

Whichever script is supposed to be passing that data along could have more to do with it at this point, since it would pass in the Transform arguments for the functions (for instance, in "LookRotation()" where the rotation is actually being applied.

 camera.localRotation = Quaternion.Slerp (camera.localRotation, m_CameraTargetRot, smoothTime * Time.deltaTime);
  • 1
  • 2
  • 3
  • ›

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

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Make a script begin its action OnTriggerEnter? Please help. 1 Answer

Unity how to access a static variable from the FirstPersonController component 2 Answers

Can I make a CharacterController slide UPhill? 1 Answer

access first person controller from other script 0 Answers

Drag to look instead of right joystick 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