• 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
0
Question by ninjanoel · Dec 02, 2014 at 09:47 PM · vector3camera movement

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.

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

1 Reply

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

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
Comment
Add comment · Show 3 · 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 thelackey3326 · Dec 03, 2014 at 04:12 AM 0
Share

There actually is a Vector3.left, as well as a down and a back.

avatar image ninjanoel · Dec 06, 2014 at 09:50 AM 0
Share

@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.

avatar image thelackey3326 · Dec 06, 2014 at 07:44 PM 0
Share

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

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Movement Relative to both Camera and XZ Plane 3 Answers

How can I Vector3 Slerp or Lerp locally? 3 Answers

Angle of 2 Vector3 on one axis 3 Answers

Using a gameObject as Raycast origin position? 2 Answers

Use Rect.Contains to define an area on touchScreens 1 Answer


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