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 H3core · Jan 11, 2013 at 04:42 AM · 2drotation

Unity Car Tutorial Rotate Snippet Chaos

So, i took this little code snippet from the Unity's Car Tutorial to rotate my 2D Car Game Wheels, for accurate rotation:

     w.wheelVelo = rigidbody.GetPointVelocity(wh.point);
     w.groundSpeed = w.wheelGraphic.InverseTransformDirection(w.wheelVelo);
                         print (w.wheelVelo);
                         print (w.groundSpeed.x);
                         print (w.groundSpeed.y);
  //w.wheelGraphic.Rotate(Vector3.forward * (-w.groundSpeed.x / wheelRadius) * Time.deltaTime * Mathf.Rad2Deg);


And in the Debug the values printed look like so:

(13.8, 0.0, 0.0) 13.80005 -0.00028884

(17.2, 0.0, 0.0) 17.20007 -0.0003456686

Looking perfect for a 2D game being left, right (x-axis), up, down (y-axis), so whats the problem...... The catch is that the rotate part is actually commented

If the comment is removed these are the values returned:

(19.4, 0.0, 0.0) 3.437649E-05 19.40008

(20.9, 0.0, 0.0) 4.99693E-05 20.90008

And guess what it doesn't end there if i change the groundspeed from .x to .y like so to fix that bug in value:

 w.wheelGraphic.Rotate(Vector3.forward * (-w.groundSpeed.y / wheelRadius) * Time.deltaTime * Mathf.Rad2Deg);

Guess what, you guessed right, the values returned are now are :

(15.7, 0.0, 0.0) 15.70005 -0.005213013

(16.7, 0.0, 0.0) -16.70006 -0.001558624

So, where does this leave us, to WTF, and me hoping im blind to something cause ive been scripting the whole day, trying hard to believe that that is no hidden unity button thats called F-Over user for some fun, and trying even harder not to say UNITY is F-IN STUPID.

Any help, insight to this wonderful encounter to Unity's Daily Coding Shafts as i would like to call it, probably fit for a YouTube Series name, it would be really great :)

Until then have a great day, and please find a way this is reported to Unity Developers

Thanks

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

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Script gives wrong rotation. 1 Answer

Disabling the Z axis? 1 Answer

2D camera rotating relatively to game object speed 0 Answers

2D sprite that always faces the player? 1 Answer

2D sprite rotation with velocity and interpolation 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