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
2
Question by Fattie · Jun 16, 2012 at 08:25 PM · jointsbonesskinnedmeshrenderermissing-documentation

Are Joints in fact Transforms?

Someone said to me: So, if you import a model with joints to Unity3D, it looks like the joints are in fact "Transforms". Is that correct?

I said "Sure, you can see here, there's a joint, click on the game object. The only component is a Transform. In fact when you change the rotation that's you bending the elbow. It would appear that a 'joint' is just a Transform and that's it. Or you could say it is 'stored as' a Transform and that's it."

Then I thought about this and said "I better check with someone smarter..."

So indeed .. is a Joint quite simply "a Transform" ... and that's it?

Is there any behind the scenes magic?

Now further on this .....

say you have two sausages ("L" and "R"), joined by a joint such that you can elbow the joint.

now, on the skinned mesh renderer of both "L" and "R", there will be shown in the component a root joint, call it "r"

now, the joint "r" will in fact have a couple of joints as children underneath it.

here ...

alt text

If you rotate the join "r", it will just spin the "whole" object (L+R). {Aside - as far as I know, that is always the case .. actually maybe not? Maybe sometimes spinning the root joint does nothing?}

But, one of the joints underneath "r" will in fact be, the famous joint between the two sausages. If you change the rotation on that joint (in fact it's labelled joint6 in the example shown), that then is you changing the elbow of the model. Hooray!

So ....... this makes me think .......... where the heck is that magic information kept? We can see that "r" is simply kept as the "Root Bone" in the skinned mesh renderer. But, where are the other two bones kept / where is it notated which one is the elbow? IE, what magic makes joint6 the elbow joint?

In fact -- glancing at the RTFM -- I assume that it's SkinnedMeshRenderer.bones ?

Or is it more something to do with the bindposes ?

(As a relatively minor side question .. which one's the "root" bone? is it simply the 0 index of the four?)

(Note that the field "Root Bone" in the editor happens to be undocumented ... http://unity3d.com/support/documentation/Components/class-SkinnedMeshRenderer.html and it does not apparently really exist in the api, that editor panel must just figure it out from somewhere.)

Furthermore, this all appears to be totally undocumented in the Unity documentation? (a) is that correct, it's a huge hole in the doco about the only interesting part of the product :) or is the doco somewhere I don't know? and (b) has some friendly Internaut produced the "missing manual" for Unity that explains all this??

Cheers!!


PS you have to wonder if "hugeBendablePurpleSausage.jpg" has ever existed as a filename before in this universe. A quick google gives fascinating matches :-O

hugeBendablePurpleSausage.jpg (20.6 kB)
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

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer Wiki

Answer by whydoidoit · Jun 16, 2012 at 08:41 PM

So I am no expert in 3D graphics and Unity especially (given I've be using it for only the last 5 months). Yep I learn a lot on Unity Answers :)

What I have done is write a multiple bone/multiple end effector IK solver for Unity - so I feel I know a little about this subject.

I think you need to consider two things: the skeleton and the skinned mesh attached to it.

When it comes to the skeleton a bone is effectively a combination of one end's transform.localRotation and the localPosition of the subsequent child "end"'s transform. The magnitude of the localPosition as a vector is the length of the bone (and it is usually just down one axis so as not to confuse the calculation of the rotation which directs it - though apparently not always).

Now the skin is distorted by the position of the bones and the vertices of the mesh are affected by one or more bones in the skeleton - as configured by the 3D modelling package.

So yes - joints are just Transforms

Comment
Add comment · Show 13 · 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 whydoidoit · Jun 17, 2012 at 07:05 AM 0
Share

It is the ultimate parent of the other transfoms, as it doesn't have a parent itself it can't be angled but it can be translated.

avatar image whydoidoit · Jun 17, 2012 at 08:52 AM 0
Share

Yeah I started this answer and realised I hadn't done that bit :) hence the community Wiki :) I believe that the root bone is calculated by Unity from the list of transform that are provided on Skinned$$anonymous$$eshRenderer and the Inspector is just automatically creating bones from the children of the transform you supply.

avatar image whydoidoit · Jun 17, 2012 at 08:53 AM 0
Share

It would be the ultimate parent transform in the array you provide. No idea what would happen if you supplied an array that had two unconnected hierarchies. Havent tried, it could be an error condition or feasibly it could search for a common ancestor.

avatar image whydoidoit · Jun 17, 2012 at 01:01 PM 0
Share

Yeah I think it is automatically calculated. There is an actualRootBone internal, which I would bet works it out from the array. We're at the point where I'm not sure though I'm afraid. $$anonymous$$y I$$anonymous$$ solver works on existing meshes (and in fact does to by using the hierarchy to work out the relationships).

avatar image Bunny83 · Jun 17, 2012 at 02:26 PM 0
Share

@whydoidoit: Do you play to publish your solver, or is it an internal project? Have you really done an inverse kinematic calculation or is it an iterative approach? Do you have a bone / limb limit?

This sounds really interesting. There aren't not many good solvers out there, at least not for free :D. If it's finished you want to put in on the AssetStore ;)

Show more comments
avatar image
2

Answer by Jessy · Jun 16, 2012 at 08:33 PM

Joints are Transforms. Typically animated ones. Each vertex in a mesh is transformed based on boneWeights.

Comment
Add comment · Show 4 · 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 Fattie · Jun 17, 2012 at 08:36 AM 0
Share

Thanks for that Jessy. In a word, how would I set that "root bone" in code?

avatar image Bunny83 · Jun 17, 2012 at 12:06 PM 2
Share

You can't set the root bone. You have to set the whole bone array and it has to match the order the bones has been exported. This is usually done by the importer since the importer will create the bone-hierarchy and knows the order. See Skinned$$anonymous$$eshRenderer.bones. There you have to assign your bone array. The relationship between bones doesn't matter, it's a linear array with all bones. You could even unparent them and move them manually. The relation to the model is done by this array.

avatar image whydoidoit · Jun 17, 2012 at 10:17 PM 0
Share

It is certainly not the 0th entry in the bones collection :)

avatar image Fattie · Jun 18, 2012 at 12:28 PM 0
Share

Good to know, It is certainly not the 0th entry in the bones collection .... thanks! That's cleared up.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Draw Gizmos without Depth-test 1 Answer

Does the transform.parent hierarchy have any relationship to the bone hierarchy? 1 Answer

How can I get the original bone bind position ( and not the matrix)? 1 Answer

Animation: Keeping bones attatched 2 Answers

Adjust bones transforms to follow blend shapes? 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