Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 JPLeo · Apr 25, 2014 at 02:40 PM · rotate object

Quaternion.Slerp real Speed

Hi guys, i have a question for those of you experienced with the inner workings of unity (the Slerp method to be more specific)

I have an object following another's rotation using Quaternion.Slerp, what i can't find out is if a bigger difference on the rotations(moving the mouse faster) will make the rotation faster, or if the only thing that actually affects the speed of an object being rotated with slerp is the interpolation value(therefore having constant angular velocity once at maximum)

Comment
Add comment · Show 2
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 · Apr 25, 2014 at 03:06 PM 0
Share

I need to see your code, and in particular how you are using Slerp(). There are a couple of common, different ways of using Slerp() and their behavior is different.

avatar image JPLeo · Apr 25, 2014 at 04:47 PM 0
Share

Turret.transform.localRotation = Quaternion.Slerp(Turret.transform.localRotation, $$anonymous$$asterGO.transform.localRotation, TurSpeed * Time.deltaTime);

Turret.transform.localEulerAngles = new Vector3(0.0f, Turret.transform.localEulerAngles.y, 0.0f);

1 Reply

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

Answer by robertbu · Apr 25, 2014 at 05:01 PM

This is a common use of Slerp() on Unity Answers, but it is a non-traditional use. It works by walking approximately the same percentage towards the goal angle each frame. Since the starting angle is updated to the current angle each frame, the same percentage represents ever decreasing amounts of rotation as the current rotation moves towards the goal rotation. This results in an eased rotation. As for your question the greater the angle (and I assume you get a greater angle by moving the mouse faster), the greater the initial angular velocity. The only maximum velocity is when the start and end angles are 180 degrees apart, and the angular velocity drops in a non-linear fashion towards the goal.

Note if you wanted to do some testing, you could save the rotation just before the Slerp(), use Quaternion.Angle() to get the angle between the save rotation and the new rotation. Dividing the result by Time.deltaTime will give you the angular velocity for that specific frame. Note that deltaTime does not remain constant, so the velocity will jump around a bit from a perfect curve.

Comment
Add comment · 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

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

20 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

Related Questions

I need help with my character's rotation script 1 Answer

one gameobject postion to another gameobject rotation 0 Answers

RotateTowards in a specified direction 0 Answers

Billboard script restrictions 1 Answer

Rotate the shortest way? 6 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