Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 tieTYT · Aug 18, 2011 at 10:08 PM · transformtransform.position

Where is the transform.position inside of a GameObject?

I'm new to unity and game development but I've been thinking about this problem. I don't know where the transform.position of a gameobject really is and the documentation kind of skips that detail. If I create a new cube, is the transform.position smack dab in the center or the object or is it in the center at the bottom or something else completely?

Isn't knowing the position of the transform essential to finding the sides of the mesh? For example, the x of the right side of a cube would always be transform.position.x + 5 in a 10x10x10 cube if the transform.position is exactly in the center. But, it's transform.position.x + 10 if the transform is in the upper left corner so I feel like knowing the transform.position is really important.

How else can I attach prefabs together? I want to build walls without gaps between them.

Comment
Add comment · Show 3
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 Scribe · Aug 18, 2011 at 10:40 PM 0
Share

for default shapes I think its always exact centre, but if you make it the child of a parent somewhere else you could use the parents position, not that that would really help ;) you can do the maths very easily for a cube anyway to make them have no gaps inbetween

avatar image Bunny83 · Aug 19, 2011 at 01:14 AM 2
Share

Btw: Unity supports vertex-snapping in the editor. Just hold down "v". You will be able to grab the object at the nearest vertex. It will automatically snap to any other vertex around.

You can also grab the object at the center handle and after that press "v". now you can use the objects pivot to snap it to another vertex.

avatar image Scribe · Aug 19, 2011 at 08:03 AM 0
Share

I didn't know that @Bunny83 that will be useful for me thanks :)

1 Reply

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

Answer by Eric5h5 · Aug 18, 2011 at 10:11 PM

The transform.position is wherever the pivot point of the mesh is.

Comment
Add comment · Show 1 · 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 Owen-Reynolds · Aug 19, 2011 at 05:45 PM 0
Share

Yah -- it's really a modelling question. A gun made in 3DS max or Blender might have transform.position at the trigger (makes it easier to put in char's hand) or might have it dead-center to make it easier to spin in the weapon select box, or back-center for easier wall-mounting... . A spear could have transform.position at the butt, middle or tip.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

transform.position not executed with OnTrigger2D 1 Answer

transform.position.x brings up error 1 Answer

Move gameObject with mouse 1 Answer

Attaching Object to mouse 1 Answer

How to determine speed of an object when using transform.position 2 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