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
1
Question by HauntedHotPocket · Aug 25, 2014 at 11:14 PM · local axis

local axis vs world axis

This is an embarrassingly simple question, but how do I access the the localX axis of a transform vs the world?

I'm using myObject.transform.localPosition.right, but it's clearly still using the world axis when I test. Any clues what I'm doing wrong?

If it helps, I see in the doc description for transform.localPosition: "Position of the transform relative to the parent transform." My object has no parent other than the world itself, so I guess the origin is the parent? Just wanted to mention it in case it helps clarify.

alt text

worldlocalaxis.jpg (86.4 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
1

Answer by psantoki · Aug 26, 2014 at 12:49 AM

transform.right

Also useful: transform.up, transform.forward

These will give you the three axes of your object in local space, together can construct an orientation matrix, though you can get that from the transform too.

Good luck my nig nog

Unity Transform.right

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
avatar image
0

Answer by psantoki · Aug 25, 2014 at 11:26 PM

Hi HauntedHotPocket

  1. transform.position

  2. That said, you're actually getting the right answer. If an object has no parent, then its world transform is the same as its local transform.

  3. So keep on keeping on

Comment
Add comment · Show 8 · 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 psantoki · Aug 25, 2014 at 11:30 PM 0
Share

Re-reading your question, you might be asking about orientation, not position. Let me know

avatar image HauntedHotPocket · Aug 25, 2014 at 11:37 PM 0
Share

Hmm, then I guess I'm after the wrong thing. When I test and I select my object, then toggle between world and local, I see one transform that remains in the same xyz when I rotate (world), but when I toggle (local) its a transform that updates with the rotation. That's the one I'm trying to access. I'd like to get the transform.position.right, based on where the object is facing.

avatar image HauntedHotPocket · Aug 25, 2014 at 11:58 PM 0
Share

^ Does this make sense? It might be what you meant about orientation vs position. I'm not sure. Just want to get the x axis based on which way the object is facing.

avatar image psantoki · Aug 26, 2014 at 12:02 AM 0
Share

Is this the button you're toggling?

And is that the position you're looking at?

(Just to be clear)

alt text

localglobal.jpg (140.5 kB)
avatar image HauntedHotPocket · Aug 26, 2014 at 12:09 AM 0
Share

Yes, that's the one! I'm doing something wrong aren't I?

Show more comments

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

24 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Head bone rotation question 0 Answers

How to change the position of the Gameobject in 10 second? 1 Answer

Why are my projectiles not following Input.pos after transform movement? 2 Answers

problem with dead space kinesis module system 1 Answer

How can I get an object to orientate behind a plane? 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