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 MgBag · Mar 13, 2011 at 01:51 PM · euleranglesmaximumminimum

Maximum Rotation

Alright, yes. I asked this question before.

But there is a twist! See, I got this code working -thanks to Bobadebob.

function Update ()
{
    if (transform.eulerAngles.y >= 10)
        transform.eulerAngles.y = 10;
    if (transform.eulerAngles.y <= -10)
        transform.eulerAngles.y = -10;
}

But ever since -10 = 350 and the other way around. So the model skips between 10 and -10 all the time whenever I exceed the maximum or minimum. I just wan't my model to not be able to exceed the angle of 10 and -10(350).

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
0

Answer by Ashkan_gc · Mar 13, 2011 at 02:30 PM

yes they are them same (-10 = 350) so use only positive numbers and you will be good to go. because 355 is greater than 10 and also less than -10. unity don't use euler angles for calculations so i don't know what exactly will happen.

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 loopyllama · Mar 13, 2011 at 03:18 PM 0
Share

but if it is 350 it is really -10 yet his code would set it to 10, which is not right

avatar image loopyllama · Mar 13, 2011 at 03:29 PM 0
Share

also set all rotations at once...the docs say you will get drift if you set only one angle...

avatar image MgBag · Mar 13, 2011 at 08:37 PM 0
Share

That won't work either. Ever since 350 also is more then 10 it might and will jump to 10 or -10 Its quite random. I just want my model to not be able to exceed those limits. This script wont work.

avatar image
0

Answer by MgBag · Mar 14, 2011 at 02:42 PM

I posted a new question. Stopping this post.

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

No one has followed this question yet.

Related Questions

Mouse look X axis not working? 0 Answers

Maximum Rotation 1 Answer

mathf.min and mathf.max 3 Answers

How would I find multiple peaks and valleys in an array of values? 1 Answer

how to set a max health and mana 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