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 Nankong · Mar 12, 2016 at 02:33 PM · unity 5rotationjointkinect

Rotation doesn't work with JointOrientation from kinect in Unity3D 5

A weird thing happen to my code, I don't know why I worked like this, but it did.

My code is like this:

             // Getting joint orientation data from kinect 
             // and construct it with Unity Quaternion
             Kinect.Vector4 targetRotaV4 = body.JointOrientations[jt].Orientation;
             Quaternion targetRotaQ = new Quaternion(targetRotaV4.X, targetRotaV4.Y, targetRotaV4.Z, targetRotaV4.W);
             Debug.Log("target rotation: " + targetRotaQ); // it did print something
 
             // Rotate the gameobject from its local rotation 
             // to the rotation I got from kinect
             jointObj.localRotation = Quaternion.RotateTowards(jointObj.localRotation, targetRotaQ, 45.0f);
             Debug.Log("Joint Object rotation: " + jointObj.localRotation); 
             // It did print value, too, not just (0, 0, 0, 0), 
             // but in the game, the gameobject didn't rotate, and the rotation didn't change in properties which kept 0
 
             // But!! When I ran the following code, it rotated! Everything looked good.
             /*
             Quaternion testRote = new Quaternion(0.1f, 0.1f, 0.1f, 0.1f);
             jointObj.localRotation = Quaternion.RotateTowards(jointObj.localRotation, testRote, 15);
             Debug.Log("Joint local rotation" + jointObj.localRotation);
             */

So my question is, why! Why the rotation couldn't work with my JointOrientation data from kinect which I did get the data because I print the value and it was not null or 0.

Plz help me out!

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 totovr92 · Nov 22, 2018 at 01:15 PM

Because the Kinect quaternions seem to assume that any bone points to the sky before rotating,
I turned the bones of my model to the sky before applying the quaternions.

I think you observed your model was jerky and unstable because the quaternions rotated wrongly oriented objects.
Suppose a quaternion rotates objects around y-axis and consider rotating the following two objects by it.

leftArm.transform.rotation = ElbowLeft * Quaternion.AngleAxis(90, new Vector3(0, 1, 0)) * Quaternion.AngleAxis(-90, new Vector3(0, 0, 1));

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Why is this code in the script not stopping the rotation of the Gameobject? 0 Answers

Many objects with decimal place in the millionths, can this cause any performance issues? 0 Answers

Quaternion * Vector does not work (and its not about the order) 0 Answers

3D Look at Mouse relative to Camera direction 0 Answers

How to send Kinect skeleton data through Unity networks (multiplayer) 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