• 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
Question by chuckg · Mar 12, 2015 at 05:52 AM · rotationquaternioneulerangleslocalrotation

how to apply overall rotation to collection of rotated objects

The question is bad, but I can't think of how to put it succinctly.

I have an object composed of several cylinders. Each cylinder is a body part, and the position information from Kinect is used to position and rotate each cylinder to mimic a human body. For example, the forearm is put in place by:

bone.transform.position = ( wristposition + elbowposition )/2f;

bone.transform.up = (wristposition - elbowposition );

That works well enough to be convincing. Now I would like to rotate the entire bone pile to match the world rotation of the parent body. Everything I have tried so far has been no good. Either the bone pile sternly faces straight down the Z-axis, or the bones rotate around their center in a most non-human way.

Any ideas?

Comment

People who like this

0 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 AlwaysSunny · Mar 12, 2015 at 04:36 AM 0
Share

Can these not be parented to a root object? You'd have to set their localPosition and localRotation, etc, instead of simply "position" and "rotation", but it would allow you to drive root motion by whatever means you like. Sounds really cool btw, I'm jealous. :)

avatar image chuckg · Mar 13, 2015 at 03:03 PM 0
Share

The bone.transform.up does not seem to have a "local rotation" -- looks like it uses only world rotation.

Here is a vastly simplified version:
Create a cube of one unit size.
As a child of the cube, create a cylinder that is size ( 0.2, 2, 0.2 )

Attach a script to the cube with void Update () {transform.Rotate (Vector3.up * 30f * Time.deltaTime);}

Attach a script to the rod with void Update () { transform.up = new Vector3 (2, 2, 2);}

Run it, and you will see that the cube rotates but the rod does not. Somehow I need to change the direction to which the rod points based on the rotation of the cube. Right now I'm going down the path of instantiating small balls at the location of each joint, then rotating that. Then take the world coords, and use them to point the bones. Very clunky and stupid wasteful, but it seems to work.

What I want is to eliminate the unnecessary step of creating joint balls, and just do the math I need.

0 Replies

  • Sort: 

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Complicated Rotation Issue 1 Answer

Why is my object's local x rotation not going past 90 degrees? 1 Answer

Code to rotate around a local axis until local Y is 0? 0 Answers

How to get rigidbody local z axis rotation in Euler angles? 0 Answers

How to make camera rotation relative to target. 3 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