• 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 siddharth3322 · May 13, 2015 at 04:13 PM · transformvector3directionup

Difference between Vector.up and transform.up

Basically my question title says everything related to my question. What is the difference between Vector.up and transform.up?

If I have asked silly question then forgive me but at present I can't able to understand these two terms. Please give some suggestion in this.

EDIT : Whether it create any difference if we use anyGameObject.transform.up?

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
3
Best Answer

Answer by fafase · May 13, 2015 at 04:37 PM

Vector3.up is constant and corresponds to the world up so (0,1,0). It is the yellow arrow on hte gizmo in the scene view.

tranform.up corresponds to the yellow arrow on the object and is related to it. As you rotate your object, the gizmo on the object moves and all three arrows change direction (not magnitude, always 1). transform.up, right and forward gives you the vector to which they correspond in world space.

So if no rotation, all three are equal to their world equivalent but as you start rotating, they change. In the case of a character, it is most likely rotating around its transform.up so that vector actually never change.

Got it?

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
2

Answer by tebandesade · May 13, 2015 at 04:20 PM

Hi well first of all vector is (x,y,z) an other words a normal vector. Therefore, it will indicate to go up 1 pos in the Y axis. On the other hand, transform has three componentes as well, x,y,z. Nonetheless, the transform could be placed not in the normal (x,y,z) pos we know, but locally it can differ for instance maybe the transform of a gameobject of mine is rotated 90 degrees to the right, therefore the Y transform will be the X vector wise and so on

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 tebandesade · May 13, 2015 at 04:41 PM 1
Share

It will create any difference if your Gameobject's transform is rotated compared to the normal Vector (x,y,z) position . Look at the green arrow( Y's transform position -"up") alt text

It is as a normal vector right? If you do transform.up it will be the same as Vector.up because both are pointing towards the same direction. Yet, if your transform rotates like this alt text

See that the green arrow is pointing right, that is your transform's y coordinate so if you do transform.up it will be the same as doing vector.right.

captura-de-pantalla-2015-05-13-a-las-113905-am.png (19.7 kB)
captura-de-pantalla-2015-05-13-a-las-113900-am.png (21.2 kB)

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

20 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

Related Questions

How to rotate an object to face the direction it's going? 1 Answer

teleport player in the direction they are looking, 1 Answer

Declaring Vector in inspector for directional movement 1 Answer

Transform continue direction 0 Answers

Finding difference between gameObject's x coordinate according to one object's transform 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges