Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Soloman23 · Feb 18, 2016 at 08:43 AM · vector3positioningx axis

Need help with coordinate conversion.

Hi, I hope you guys can help me out here, I love coming to these forums there's so many answers on here!

I'm having a problem with an IK solution I've wrote, but the problem isn't the IK, the problem is getting coordinates that I need to position things right.

Here's a first bit of code that explains what I'm looking for

 //The originalFootTransform is actually a transform that gets assigned from an instantiated point (at start), thats parented to the players transform 
         //(meaning it is a child immediately under the players transform), and is positioned to the foot.
         //The leftFootTransform is the current (updated every frame) HumanBodyBones transform for the LeftFoot.
         Vector3 relativeLeftFootPos = originalLeftFootTransform.TransformPoint(leftFootTransform.localPosition);
 
         //I need the local x coordinates on the leftFootTransform to be converted 
         //to the coordinates that it would have if it was parented to the same object as the originalLeftFootTransform
         //so that I can determine the distance between the two along the local x axis
         //and I'm finding the distance so I can tell the ik, okay we need to move back to the leftFootIKObj because our feet are to far appart or too close together
         Debug.DrawRay(relativeLeftFootPos, Vector3.up);
 
         //I wanna find the distance between the two on the local x axis
         float distanceXLeftFoot = Mathf.Abs(originalLeftFootTransform.localPosition.x - relativeLeftFootPos.x);
 
         //I got this print going along with the debug ray so I could see all the transfrom conversions visually, but I just cant seem to find one that works
         //I may just be doing to much, it seems like such a simple thing
         print(distanceXLeftFoot);

My Problem

 Vector3 relativeLeftFootPos = originalLeftFootTransform.TransformPoint(leftFootTransform.localPosition);

Like I said in the code sample, I want to convert the LOCAL coordinates of the current left foot transform, to the coordinates that it would be if it was parented to the root parent, so that i can determine the distance between the start position of the foot and the current position of the foot along LOCAL the x axis. I don't know how I could explain it any more detailed, thanks guys.

Comment
Add comment · Show 1
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 Soloman23 · Feb 17, 2016 at 11:06 PM 0
Share

So in a way I want to convert local coordinates, to local coordinates, so its under the parent objects coordinates. but i wanna convert the left foot (thats is parented under many objects in the root object) coordinates to be relative to our local transform. If that makes any sense :P

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Soloman23 · Mar 01, 2016 at 02:59 PM

Solved this by using transform.InverseTransformVector(leftFootTransform);.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How would i clamp X and Z without clamping Y? 1 Answer

Get an array or list of points and normals of mesh surface (Not vertecis) 1 Answer

How to find point just outside of box collider? 1 Answer

Player Positioning on a Rotating Circle 0 Answers

Having issues with offsetting an object 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