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 NeoMopp · Jul 16, 2013 at 10:44 AM · c#transformpositionassetmodel

Obtaining the relative size of a Models body part

Hello there,

I am trying to calculate the xyz position of "important" regions on my models, I am doing this by:

 Transform [] allChildren = this.transform.GetComponentsInChildren<Transform>(); 
 foreach (Transform child in allChildren)
 {
            Vector3 objectPos = child.transform.position;
 }

However this only gives me an xyz coordinate of the center of each object. However what I need is the xyz coordinates of points like the elbow and shoulder, instead of these I am actually obtaining the xyz coordinates of the center of the upper arm.

One way I can see of obtaining the coordinates I need would be to obtain the size of the upper arm and then extrapolate the location of the Shoulder and elbow from that.

How would I go about obtaining the size of the body part to calculate this? I'm pretty stumped right now.

Note: I am using this Model

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 Benproductions1 · Jul 16, 2013 at 10:51 AM

Hello,

As you might have noticed this is nowhere near as simple as it sounds. Your solution would require you to analyse the mesh data of that object. If you are confident enough to be able to find the vertices that make up the elbow, then find their size, go for it. But I presume that is beyond your capabilities (gathering from the code you posted)

A much simpler and elegant solution is to have an empty object representing the elbow point as a child of the elbow joint. Getting the "xyz" position of that points would be as simple as grabbing a reference of that objects Transform component and doing Transform.position.

Hope this helps,
Benproductions1

PS: If you do want a solution to actually find the size of the elbow, I can give you more detail to one I just came up with ;)

Comment
Add comment · Show 2 · 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 NeoMopp · Jul 16, 2013 at 11:08 AM 0
Share

$$anonymous$$y intent isn't to actually work out the size of the elbow but to actually get the elbows xyz coordinate. By getting the size of the arm i would in theory be able to work out the xyz position of the elbow....As you mention the elbow joint is there a way of obtaining a joint right out?

avatar image Benproductions1 · Jul 17, 2013 at 12:54 AM 0
Share

As I said, if you want to find the elbow joint, the best method is an empty, reference object. If you don't understand the words I used in my answer, look them 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

16 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

Related Questions

Why does object lerp to above the object it is lerping to? 1 Answer

stop object(door) translation 0 Answers

Transform.Position Collision Issue 0 Answers

If gameobject moves do this 1 Answer

How do I check if an Object isn't moving? (C#) 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