Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 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 /
This question was closed Mar 02, 2016 at 11:10 PM by Le-Pampelmuse for the following reason:

The question is answered, should have been closed 6 years ago.

avatar image
0
Question by Kevin 1 · May 08, 2010 at 01:15 PM · variablescoordinatesname

Getting an object's y coordinate

Note: those who have a low tolerance of n00bs may want to leave. xD

I just switched over from "Game Maker" to Unity 3d, and thank God I did! I just need a simple answer to a simple question, as I am not very familiar with Unity3d's variables, or javascript at all in that matter...

Is there a built in variable for x, y, and z of objects? If so could you all tell me what it is and maybe direct me to where I can look up an answer to this kind of question without bothering all of you?

Thanks a thousand, Kevin

Comment
Add comment · Show 2
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 Cyclops · May 08, 2010 at 04:18 PM 0
Share

@$$anonymous$$evin, you don't need to apologise that much (or at all), but if you do want to avoid annoying people, then please read the FAQ carefully. It's the button at top-right, and is really a good idea. Also, in general for learning Unity, here's another good link to start with: http://answers.unity3d.com/questions/4897/how-can-i-start-learning-unity-fast

avatar image Ricardo · Jul 30, 2010 at 10:34 AM 0
Share

The documentation is a good starting point.

2 Replies

  • Sort: 
avatar image
8

Answer by Mike 3 · May 08, 2010 at 01:43 PM

transform.position.y

http://unity3d.com/support/documentation/ScriptReference/Transform.html

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 cdm89 · Mar 02, 2016 at 08:10 PM -1
Share

Hello, what if you want to grab the position of a different object? For example I have object A and i want know object B's position - do i need to make an instance of object b on object b's script?

avatar image pixxelbob cdm89 · Mar 02, 2016 at 10:49 PM 0
Share

@cdm89 You really should open your own question, this one is dead and buried.

avatar image
1

Answer by HolBol · May 09, 2010 at 12:42 PM

i'd use something like

function Update(){
print(rigidbody.position.y);
}

that's how i did it

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 Mike 3 · May 09, 2010 at 04:27 PM 0
Share

problem here is that it'll throw an exception if you don't have a rigidbody attached - transform should be sufficient in Update for all cases

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

How to create procedural objects from files? 0 Answers

Can you store multiple x or y coordinates from different gameobjects in one variable and then compare all the stored values in a function? 0 Answers

Player names with photon PUN 1 Answer

Get colour of a pixel on a texture? 2 Answers

How to check if the coordinate is inside the wall? 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