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
1
Question by sysameca · Aug 08, 2014 at 11:02 PM · rotationquaternionstilt

Rotation without tilt around a globe.

So i have a bad rotation week as i am doing little bit more "advanced" 3d rotations for first time in my life. So i have our planet earth in a 3d globe, rotating to a point where the mouse was clicked thanks to robertbu helping me out with the Quaternions.The problem here is that with Quaternion.FromToRotation i am getting the planet tilted at some clicked points. Is it possible to avoid the tilt?

Comment
Add comment · Show 1
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 robertbu · Aug 08, 2014 at 11:28 PM 0
Share

If I understand correctly, just assign 0.0 to the 'y' in hit.point before calling FromTo ().

1 Reply

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

Answer by Bunny83 · Aug 08, 2014 at 11:33 PM

I have a quite old sample project on my dropbox here. At the bottom it has a link to the demo package. From your description it's hard to tell what you exactly want to do and what you are doing and what's actually wrong. A graphic / screen shot or the code your using would help to understand your problem.

edit
I've found the old question to which this sample is related to:
http://answers.unity3d.com/questions/142461/centering-to-main-camera-a-clicked-point-on-sphere.html

Comment
Add comment · Show 9 · 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 Bunny83 · Aug 08, 2014 at 11:52 PM 0
Share

Just to clarify a bit: FromToRotation rotates around an arbitrary axis / plane depending on the two given vectors. it's just a relative rotation and doesn't take into account any kind of coordinate system. If you want the typical geographic coordinate system you should work with lat and lon angles.

avatar image sysameca · Aug 09, 2014 at 10:54 AM 0
Share

Yes that is the thing i needed man thanks!Never knew it can be much more complicated than a simple rotation.

avatar image sysameca · Aug 09, 2014 at 11:50 AM 0
Share

Hmm this works just fine when the sphere's starting rotation is not modified.Is it possible to calculate the current latitude and longitude with already modified rotation?

avatar image Bunny83 · Aug 09, 2014 at 02:25 PM 0
Share

I'm not exactly sure what you mean by modified. If you mean that at Quaternion.identity you don't have 0°, 0°, then the easiest solution is to parent your sphere to an empty gameobject and rotate the sphere locally to align "0°, 0°" with the identity rotation of the parent. Now when you rotate the parent it should be correct. Otherwise you can of course manually store the initial rotation and multiply the generated rotation (from lat / lon) by your initial rotation. $$anonymous$$eep in $$anonymous$$d that Quaternion multiplication isn't commutative, so you might need to reverse the order.

avatar image Bunny83 · Aug 30, 2015 at 06:01 AM 1
Share

@parndepu:
That's strange. I just downloaded the package and yes, it seems Unity can no longer properly load old unitypackages. I recreated the test scene in a newer Unity version, updated the script (collider property is now deprecated) and created a new package.

However unfortunately it's not possible to get the same look as in my original demo as Unity has changed it's default sphere mesh. It's no longer a mercator like mesh but a morphed cube mesh. The UV unwrap still tries to mimic the mercator projection but it's a bit distorted at the poles. (Of course distorted beyond the distortion that comes with the mercator projection ^^). Furthermore the unwrap is rotated 90° so the longitude is off by 90°.

You most likely don't want to use Unity's new sphere for a mercator texture. You should create a sphere in a modelling program and import that mesh into Unity.

Show more comments

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

align to floor in local X 2 Answers

Trouble Spawning Bullets with proper rotation 0 Answers

How can I turn my cube object to the direction it is traveling? 1 Answer

How can I control the yaw, pitch and roll of a flying object? 0 Answers

Weird behavior when setting eulerAngles directly 2 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