- Home /
Orientation of Vector3.forward
I want to use...
Vector3.up;
Vector3.left;
Vecotr3.forward;
...
to translate my camera's position, but the camera could be facing any direction,
eg.
(mycamera.directionOfView - defaultStartingDirectionOfView) == differnceFromDefault
newDirection == differenceFromDefault * Vector3.up;
then
camera.transform.Translate(newDirection * (velocity), Space.World);
My maths is lacking a bit so I dont have the terminology to properly explain, so feel free to use big maths words I can google later.
Answer by tanoshimi · Dec 02, 2014 at 10:06 PM
Vector3.forward
Vector3.right
Vector3.up
are always directions relative to the "world". They are the same for every object, whichever way they are facing. (Note that there is no Vector3.left
- that's just -Vector3.right
).
If you want to know local directions relative to a particular object's current rotation, use the properties of that object's transform component:
transform.forward
transform.right
transform.up
There actually is a Vector3.left, as well as a down and a back.
@thelackey3326 I think @tanoshimi is referring to the transform
static vars and not the Vector3
static vars, they are not there in transform
as i discovered, and I'd have been really confused if @tanoshimi hadn't of mentioned it.
I was just pointing out that the statement, "there is no Vector3.left" is not correct, even though the answer as a whole is correct. It's very important to have correct information on the Unity Answers site because people are more likely to accept statements found here as truth. Because of that, I think that it's important to note that transform.forward
, .right
, and .up
aren't static vars. They are instance properties of Transform that affect only the instance referred to by transform
.
Your answer
![](https://koobas.hobune.stream/wayback/20220613173023im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Movement Relative to both Camera and XZ Plane 3 Answers
Problem with free 3D - movement script 0 Answers
Controlling the speed of Vector3.RotateTowards 0 Answers
Pushing a ball in a direction -1 Answers
Issues with Bullet Ricochet 1 Answer