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 vagos21 · Aug 27, 2013 at 01:00 PM · rotationaxisconvert

rotation to axis conversion problem?

Hello, I'm trying to do a "local rotation" conversion to a Vector3 axis. What i'm trying to do is set a ConfigurableJoint.axis, to be aligned exactly as the rotation of one of my gameobject's children.

so i get the child's local rotation, and extract the axis from it, applying it to the configurable joint:

                     var angle = 0.0;
                     var axis = Vector3.zero;
 mychild.transform.localRotation.ToAngleAxis(angle, axis);
 myJoint.axis = axis;

the result is a Vector3(0.9,0.0,-0.4) but using it to set the configurableJoint.axis really doesn't give me the direction it should...

any ideas why this is happening? trying by hand some rotations, the joint axis seems to be right at (1,0,-1), for this particular example.

or is there any other more efficient way to get this rotation to a CJ axis?

thank you!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by vagos21 · Aug 28, 2013 at 10:08 PM

so, after some headbanging against the wall, i got the answer to this, in case anyone else looks for it:

to get the LOCAL direction of a gameobject's child's axis (let's say, the forward direction) the line is

 var myaxis : Vector3 = transform.InverseTransformDirection(mychild.transform.forward);

from http://docs.unity3d.com/Documentation/ScriptReference/Transform.InverseTransformDirection.html

this will give the relative direction in respect to the parent's direction, which you can then use to set something like a configurable joint axis.

:)

Comment
Add comment · 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

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

15 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

Related Questions

Calculate Pitch (-90 to 90) from Euler Angles 2 Answers

Alternate command for rotation on Android ? 1 Answer

Finding the Euler angles of an object's rotation in terms of a different set of axes 0 Answers

How can i rotate tyhorugh local axis? 1 Answer

How can I combine these two rotations? 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