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 /
  • Help Room /
avatar image
0
Question by Verilyzed · Sep 14, 2018 at 11:54 PM · rotationrotate

Rotation Limit for X Axes,Rotation Limit

Hi! I got a big problem. I want that you can look in x axes from 50 to -60. If you look at a angle than is bigger than 50 it reset you to 50. Thats all right. But if you want to go up to the -60 limit, you cant get to it. Unity resets you at 0 to 50. So you cant get up over angle 0 to -60.

Anybody help?

 if (cam.transform.rotation.eulerAngles.x < 50f && cam.transform.rotation.eulerAngles.x > -60f) {
             cam.transform.Rotate(-Input.GetAxis("Mouse Y") * mouseSpeed * Time.deltaTime, 0, 0);
 
         }
         if (cam.transform.rotation.eulerAngles.x > 50) {
             cam.transform.localRotation = Quaternion.Euler(50, 0, 0);
 
         }
         if (cam.transform.rotation.eulerAngles.x < -60) {
             cam.transform.localRotation = Quaternion.Euler(-60, 0, 0);
         }
 
         transform.Rotate(0, Input.GetAxis("Mouse X") * mouseSpeed * Time.deltaTime, 0);
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

Answer by Verilyzed · Sep 15, 2018 at 12:24 AM

SOLVED: It works after 2 hours..!

 //See Up Down
         cam.transform.Rotate(-Input.GetAxis("Mouse Y") * mouseSpeed * Time.deltaTime, 0, 0);
 
         if (cam.transform.localRotation.eulerAngles.x < 300 && cam.transform.localRotation.eulerAngles.x > 280) {
             cam.transform.localRotation = Quaternion.Euler(-60, 0, 0);
 
         }
         if (cam.transform.localRotation.eulerAngles.x > 50 && cam.transform.localRotation.eulerAngles.x < 80) {
             cam.transform.localRotation = Quaternion.Euler(50, 0, 0);
 
         }
         
         
         //See Left Right
         transform.Rotate(0, Input.GetAxis("Mouse X") * mouseSpeed * Time.deltaTime, 0);

Ive changed the negative Angles and changed from cam.transform.rotation to cam.transform.localRotation

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

183 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 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 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 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 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 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 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 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 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 avatar image avatar image avatar image

Related Questions

Check rotation of an obstacle 0 Answers

Rotate Player w/Touch Input Controls 0 Answers

How to rotate an object according to the camera's view? 1 Answer

rotate in the direction of the child 1 Answer

Regularly rotation control with keys,Regularly Rotation control by keys 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