Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by thenachotech1113 · Nov 06, 2014 at 11:20 PM · rotationvector3global

how to get local "up" in global space?

hello everyone, I am trying to do a script for the camara to moove smoothely, it was all working perfectly untill i added "transform.LookAt", this made my camera unable to go upside down and, since it`s for a space fighter, it becomes disturbimg. tried the following(according to the little i remember about vectors):

 localUp = new Vector3(Mathf.Cos(transform.rotation.z), Mathf.Cos(transform.rotation.y),
                               Mathf.Cos(transform.rotation.x));

*local up is a vector 3 variable

all i got from it was the camera to start sideways and to wobble when i turn. im out of ideas, if someone knows how to do this pls tell me.

thanks in advanced.

Comment
Add comment · Show 4
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 AlwaysSunny · Nov 07, 2014 at 12:20 AM 0
Share

I know it's correct and proper, but I laughed aloud to read your secondary alternative, @robertbu . It's good to show that that approach exists - just struck me that it looks silly. ;)

avatar image Kiwasi · Nov 07, 2014 at 12:27 AM 0
Share

@AlwaysSunny the second approach mainly exists because sometimes you want to convert a vector from local space to world space that is not up, right, left, down, forward or back.

avatar image AlwaysSunny · Nov 07, 2014 at 12:34 AM 0
Share

@Bored$$anonymous$$ormon, of course, of course. I'm such a big fan of Convenience Wherever Possible it offends my obsessiveness to behold such tomfoolery. ;)

avatar image robertbu · Nov 07, 2014 at 05:30 AM 0
Share

In included the alternate because it is common in older code posted to Unity Answers, and it is good to recognize what the code is doing.

1 Reply

· Add your reply
  • Sort: 
avatar image
7

Answer by robertbu · Nov 06, 2014 at 11:30 PM

Not sure it is the right solution for your problem, but local up in world space is 'transform.up'. You can get it also by 'transform.TransformDirection(Vector3.up)'.

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 thenachotech1113 · Nov 06, 2014 at 11:40 PM 0
Share

thanks a lot

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.

Follow this Question

Answers Answers and Comments

28 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

slowly rotate a object *need quick fix* 0 Answers

Local Rotation and then Global Rotation 1 Answer

How do I align my player transform to waypoints and without restricting Z Axis rotation? 2 Answers

Convert local forward into world vector 1 Answer

How do you make a gameobject rotate slowly to the direction of the mouseclick 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