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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by miguelvelezmj25 · Jun 07, 2014 at 09:19 PM · vector3axisconfusedaddrelativetorque

Vector3 and AddRelativeTorque

Hi,

I am new to Unity and I was looking at a tutorial online on how to make a ball roll left and right. I know that Vector3.back means (0,0,-1) where -1 is in the Z axis. This code works, but it moves the ball in the X axis.

 rigidbody.AddRelativeTorque(Vector3.back * rotation);

Coul somebody please explain me how is this working? Thanks!

Comment
Add comment · Show 2
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 MrFijiWiji · Jun 07, 2014 at 11:12 PM 0
Share

When you apply torque to an object it will rotate about the axis that you have defined, which i'm sure you already know. Think of it like this, the z axis travels from the front centre of the object to the back centre of the object, so applying torque to the z axis of the object would force it to spin around this invisible point, like an airplane propeller. Doing it on the x axis would make the object roll forwards like a wheel because the line runs from the centre of the object, left to right.

avatar image miguelvelezmj25 · Jun 08, 2014 at 03:19 AM 0
Share

That makes a lot more sense!!!! Thanks!!! But why is that I need z = -1? The positive x axis is on the right, but a negative torque makes the object rotate to the right. A positive torque makes it rotate to the left. Thus it seems to me that it is reversed. Negative torque makes the x position more positive. A positive torque makes the x position more negative. I mean, it works correctly! I just want to understand it better. Than you very much!!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by yorgaraz · Jun 07, 2014 at 11:48 PM

It is moving at the X axis is because the assumed Z axis is actually relative to the object that it is in joint/child of another object that is X axis globally.

In order for this to work globally, you have to change it to: rigidbody.AddTorque(Vector3.back * rotation);

or you could also click on alt text to switch the unity's scene editor axis presentation from global to local and vice versa.

You also might want to have a look at PositioningGameObjects page.

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 miguelvelezmj25 · Jun 09, 2014 at 10:48 PM 0
Share

Could you check at my comment above? Aren't the controls reversed?

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

23 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

Related Questions

How to Spherecast/Raycast diagonally? 1 Answer

Whats the best way to get the Distance between two Vector3? 2 Answers

How can I rotate a vector direction around an arbitrary axis? 0 Answers

make enemy only follow along the X and Z axis 1 Answer

Are there more options to rotation 'Space' relativity? 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