• 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
Question by Zerzuskan · Nov 22, 2016 at 11:51 PM · rotationscripting problemerror messageerror-messageset

Error when setting Rotation

Hi, I get an error message, which i do not really understand. Screenshots here:

https://gyazo.com/935810c34b81ecb0cada8f438a979316

https://gyazo.com/fbfe7ced30a317067c490b9060b62609

"Cannon" is a Transform.

Can Someone help me with this?

Thank you, Zerzuskan

Comment

People who like this

0 Show 0
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

Answer by FeeeshMeister · Nov 23, 2016 at 03:35 AM

Cannon.rotation does not exist as euler angles, but cannon.transform.rotation does, but I think that Cannon.transform.rotation.eulerAngles is readonly (Meaning that it cannot be changed), so if that does not work, use Cannon.transform.eulerAngles. Because the rotation transform is stored as a quaternion, the code gets the quaternion and converts it into euler angles, so it is trying to return the new euler angles, while you are trying to give it euler angles, so it returns an error. Sorry if this is difficult to understand, it is kind of hard to explain, just use Cannon.transform.eulerAngles in place of Cannon.transform.rotation.eulerAngles.

Comment

People who like this

0 Show 0 · 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

Answer by Zerzuskan · Nov 23, 2016 at 08:09 AM

cannon is a transform variable, so this should not be the problem(you cant see ist in the screenshot, so i wrote it in the question).

The second part:

So because rotation works as quaternion i cant use rotation.eulerangles to store an new rotstion as Euler angles? Like rotation.eulerangles is readonly? Can i convert the Vektor3 to an Quaternion somehow?

Comment

People who like this

0 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 FeeeshMeister · Nov 24, 2016 at 09:34 PM 0
Share

@Zerzuskan , I thought when you said, "Cannon is a transform" that was an error. Use Cannon.eulerAngles instead of Cannon.rotation.eulerAngles, if that does not work, let me know by saying @FeeeshMeister at the beginning of the question. Cannon.eulerAngles is of the type eulerAngles, which is like a vector3, but the values are clamped to 360°.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

107 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

Related Questions

Roll a Ball script error?! 2 Answers

Particle System trigger script not working,Particle system trigger script not working 0 Answers

error CS0120: An object reference is required to access non-static member `TextManagerLvl1.currentState' 1 Answer

Got this error: "ArgumentNullException: Value cannot be null." and I don't understand why 1 Answer

Trying to dynamically animate a Gimbal? 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