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 WinterSoldier38 · Jun 15, 2016 at 03:19 PM · c#rotationscripting problem

How to deal with stupid rotation system?

Hi!

Simply, I want to add a rotation to an existing gameobject's rotation.

For example, I have (0, 0, 50) and I want it to be added to rotB (0, 0, 0).

I've tried this code:

rotB *= Quaternion.Euler (0, 0, 50);

But the result is so weird, something like (2.53543, 7.54353534536, 50).

Any ideas ?

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
Best Answer

Answer by markdavidmorris · Jun 15, 2016 at 04:53 PM

One other thing to make sure of, look closely at the inspector position x, y, and z values. sometimes it cuts off the scientific notation at the end of the float, so 2.53543e-10 looks like 2.53543, when it's actually essentially 0, but some floating point rounding made it look non-zero. Just something to check.

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 WinterSoldier38 · Jun 15, 2016 at 05:26 PM 0
Share

O$$anonymous$$, this is the measure of the weird angle. alt text

Does this mean actually 0 in-game?

screenshot-2.png (1.6 kB)
avatar image
0

Answer by markdavidmorris · Jun 15, 2016 at 03:59 PM

Have you tried: rotB = Quaternion.Euler (rotA.eulerAngles.x, rotA.eulerAngles.y, rotA.eulerAngles.z + 50f);

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 WinterSoldier38 · Jun 15, 2016 at 04:35 PM 0
Share

Same thing here

avatar image markdavidmorris WinterSoldier38 · Jun 15, 2016 at 04:40 PM 0
Share

Have you tried printing the euler values right before and after this operation to make sure nothing else is changing the x and y eulers?

avatar image markdavidmorris · Jun 15, 2016 at 05:31 PM 0
Share

That's right, what you're seeing is a rounding error that is essentially 0 in the game. Pretty much the only way this would cause a problem is if you're doing some kind of if(rotB.eulerAngles.x == 0f) check. Otherwise, you shouldn't notice any difference between this and perfect 0f.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

.rotation doesn't seem to work, can't shoot projectile at mouse coordinates 0 Answers

Searching a function to get the rotation of one Vector3 in relation to another 1 Answer

Limiting gameObjects rotation on Zaxis giving wierd results 1 Answer

How do I limit an object to rotate back and forth between 2 angles? 1 Answer

Problems with limiting angles 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