Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
4 captures
13 Jun 22 - 14 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 Seve2 · Feb 14, 2021 at 05:55 PM · scripting problemguitextureinterfacerotation axisangleaxis

Why does the value I passed from a different script affects the x axis of the game object even though I inserted the value in the z axis

 script passing the angle
 var acos = Mathf.Acos(dotCosangle);
 cosAngle = acos*180/Mathf.PI;
 someInt = (int)Mathf.Round(cosAngle);
 changeDialAngle.ManipulateAngle(cosAngle);
 
 
 //second script where the angle is passed to
 float GetDial()
     {
         float angleRange = minRotation - maxRotation;
         float rotationNormalized = rotnorm / rotMax;
         return minRotation - rotationNormalized * angleRange;
     }
 
     public void ManipulateAngle(float newAngle)
     {
         Debug.Log(newAngle);
         rotnorm = newAngle + 0;
         pointerHolder.eulerAngles = new Vector3(0,180, GetDial());
     }
 s![alt text][1]
 Notice from the picture the meter changes direction


[1]: /storage/temp/175985-save2.jpg

save1.jpg (64.2 kB)
save2.jpg (65.9 kB)
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 jackmw94 · Feb 14, 2021 at 06:57 PM 0
Share

The only thing that springs to $$anonymous$$d would be that your transform hierarchy is setup such that when you set your dial’s global rotation it locally rotates around its own x-axis? If I was closer to a laptop I’d test and post this as an answer but in my uncertainty I can only comment and say test this by changing the pointer holder rotation assignment to:

 pointerHolder.localRotation = Quaternion.Euler(0f, 180f, GetDial());

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by MUG806 · Feb 15, 2021 at 08:51 PM

One of these questions where it is hard to know whats going on without knowing what the full set up for the object is, but a couple of random guesses: Is it possible that you need to use localEulerAngles instead of eulerAngles? is the object's rotation offset by a parent object? Have you tried flipping the axis around on this line:

          pointerHolder.eulerAngles = new Vector3(0,180, GetDial());
          //maybe try:
          pointerHolder.eulerAngles = new Vector3(GetDial(),180,0);
          //etc
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

212 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 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

Find all scripts attached to an object that implement a certain interface 1 Answer

Rotating cube steadily around world axis not working properly 0 Answers

i need to rotate cube in z axis or x axis one direction at time 0 Answers

How do i bring back the GUI option in the scene view 0 Answers

GUITexture not corresponding with position 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