Hi, I have an issue with up vectors. I am working on island demo scene and i have the following piece of code
where Cabana2 is one of the two cabans in the scene and gt is a guitext element. As answer i get (0.0, 1.0, 0.0) which makes me think that the vector is in local space (while api reference says world space). So I tried this
But again I get (0.0, 1.0, 0.0). I get (0.0, 1.0, 0.0) even with
where cm is the main camera. So, what is the correct way to obtain the vector in world space?
asked Jul 23 '10 at 12:42 PM
Unless you have rotated your cabana on either the x or z axis, then the up direction will be the same as the world direction. Transform.up will give you the world space Vector so if
I don't think you understand the idea of a direction. Vector3's can be confusing when you first start because they are used for multiple things with different meanings.
Unity makes no differential among the 3. Each function that takes a Vector3 self determines how it uses it. Some might take a Vector3 and use it as a position like transform.position while others take a direction such as Rigidbody.AddForce(). If you wanted to, you could take a Vector3 that was created with a certain use in mind and plug it into a different form.