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.

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

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