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 hoogemast · Sep 08, 2016 at 07:15 AM · rotationinspectoranglesdebugger

Rotation angles not corresponding (inspector, debugging)

i everyone,

At this moment i collect translations and rotations from a seperate file through an Streamreader. From this file I access for example the transform of {x= 0,1 , y=0,4 ,z =0.55, w =10, p=-80, r=-0,725}. This looks all fine and i would like to move an object to that point. When doing such thing I let the object move to the specified transform and create a breakpoint (or printing with Debug.log) to check the transform values in visual studio. These values correspond to the values specified above. However when I'm watching the values in the unity inspector, they give me rotations that are close to the specified ones, but not precisely the same (e.g. {x=0.1,y=0.4,z=0.55, w=9.944, p=-79.938, r=0.713}). I understand that there are floating points and some of the error could come from floating points when using decimal values, but i dont understand why this error would be this big (10 degrees vs 9.944 degrees is a big difference in my program) and why does the debugger give the correct values and the inspector a different one.

if someone can enlighten me i would many thanks.

greetings Hoogemast

Comment
Add comment · Show 6
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 doublemax · Sep 08, 2016 at 07:37 AM 0
Share

As the inspector shows local rotation, is it possible that the objects have a parent object that is not exactly rotated to 0,0,0 ?

avatar image hoogemast doublemax · Sep 08, 2016 at 07:43 AM 0
Share

Nope, the gameobject i use is the parent and the script is also attached to the parent.

avatar image doublemax hoogemast · Sep 08, 2016 at 08:38 AM 0
Share

When doing such thing I let the object move to the specified transform

Is that an animated move? Depending on how you do it, you sometimes don't reach 100% of the target values.

$$anonymous$$g. check this code:

 public IEnumerator FlyTo( Transform start, Transform end, float duration )
  {
    Vector3 start_position = start.position;
    Vector3 end_position = end.position;
  
    float elapsed = 0;
    while (elapsed < duration)
    {
      float v = elapsed / duration;
      start.position = Vector3.Lerp( start_position, end_position, v * v * (3.0f - 2.0f * v) );
      elapsed += Time.deltaTime;
      yield return null;
    }
    start.position = end.position;
  }

Without the start.position = end.position you wouldn't always reach the target value exactly.

Show more comments
Show more comments

0 Replies

· Add your reply
  • Sort: 

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

67 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

Related Questions

UnityEditor.TransformUtils.GetInspectorRotation(gameObject.transform).x is this good for use to my game? 1 Answer

How to get inspector rotation values ? 2 Answers

Issue finding an angle with trigonometry 1 Answer

How to check object "rotated" X degrees 1 Answer

Setting rotation Angle / rotation question 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