Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 siddharth3322 · Apr 27, 2017 at 10:18 AM · camerarotationquaternionslerp

Gameobject Rotation Calculation

I want some help in rotation of Gameobject calculation. My player moving across pipe tunnels at different rotation, that calculation become difficult to perform for me.

Here are example of these worst situation:

alt text

alt text

In above example, I just want to take left rotation then also two axis get modified, rather than single axis modification. If I just turn only one axis then rotation not get affected, it taking other rotation.

At present I was using this code for moving on path and its iTween that detecting my rotation.

    iTween.MoveTo(gameObject, iTween.Hash("path", positionVectorPoints, "time", ((transform.position - positionVectorPoints[positionVectorPoints.Length - 1]).magnitude / (speed * 1.5)),
             "easetype", iTween.EaseType.linear, "orienttopath", true, "oncomplete", "OnCompleteRotate"));

So how to calculate rotation when I want to take turn at specific direction?

I hope, I explained my problem clearly. Please give me some suggestion regarding this.

90rotation-2.png (301.7 kB)
90rotation-1.png (290.4 kB)
Comment
Add comment · Show 3
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 AtGfx · Apr 27, 2017 at 11:44 AM 0
Share

Why don't you simply use Transform.Rotate ? Apply it on your camera transform and set the angles you want. If you know your start and end position between which you want to rotate, you can calculate the intermediate angles quite easily.

avatar image siddharth3322 AtGfx · Apr 27, 2017 at 11:49 AM 0
Share

By touching actual gameobject when I try to apply rotation then also its two axis get modified when I reach at target. If I just give single axis modification then it will result into wrong direction rotation.

avatar image AtGfx siddharth3322 · Apr 27, 2017 at 11:57 AM 0
Share

So you make a mistake in how you use the rotation... Don't forget that by default the rotation is calculated in object local space, there is a parameter to calculate the rotation in world space (but you must set it explicitely). If you mix these 2 coordinate spaces, it will result in incoherent result as you explain.

0 Replies

· Add your reply
  • Sort: 

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

101 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 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 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 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

Transition current camera rotation to 0,0,0 1 Answer

Quaternion Euler and Slerp: subtracting degrees only works up to a certain angle 1 Answer

How to force camera rotation? 1 Answer

Camera rotation the same as player rotation 1 Answer

Quaterion.Slerp + Lookat, camera flipping 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