Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Hamesh81 · Jul 07, 2015 at 01:20 PM · vector3rotatespeedslerprotatetowards

Controlling the speed of Vector3.RotateTowards

I was originally using a Vector.Slerp to rotate an object to a certain angle, however I didn't want any easing in the rotation. Therefore I changed my code to use Vector3.RotateTowards instead which solved the easing issue. My code now looks like this:

Start

 originalRotation = door.eulerAngles;
 openRotation = new Vector3 (originalRotation.x, originalRotation.y + doorAngle, originalRotation.z);

Update

 door.eulerAngles = Vector3.RotateTowards(door.eulerAngles, openRotation, doorSpeed * Time.deltaTime, 0.1f);

The issue now is that no matter what "doorSpeed" (maxRadiansDelta) is changed to, the rotation speed of the object does not change. However, changing the maxMagnitudeDelta (0.1f above) does change the speed. I am confused as to what the difference is between maxRadiansDelta and maxMagnitudeDelta, and more specifically which of the two should be used to control the rotation speed. In the Unity Documentation example the maxRadiansDelta is made to equal speed * Time.deltaTime so I assumed that this controlled the speed, but that doesn't seem to be the case for my code.

Could someone please explain to me how this works? I have used Quaternion.RotateTowards previously, however for this situation, since I am using specific angles I feel that it is much easier to work with vectors than quaternions.

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 Owen-Reynolds · Jul 07, 2015 at 02:27 PM 0
Share

V3.Slerp has easing? Are you sure? The docs says it's linear (so no easing.)

avatar image _Gkxd · Jul 07, 2015 at 02:36 PM 0
Share

$$anonymous$$ost likely the easing is caused by using the result of the previous lerp as a value for the current lerp.

The illustration on this page kind of describes what's happening.

avatar image Pangamini · Jul 07, 2015 at 02:49 PM 1
Share

Don't use result of previous lerp in another lerp. Don't use deltaTime as argument for lerp. It just means you don't know what you are doing.

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

24 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

Related Questions

Rotate slowly to target position? 3 Answers

Vector 3. Slerp 1 Answer

How to make top-down objects rotate to face another? 1 Answer

Rotate Towards doesnt work as expected 2 Answers

Vector3 precision issue? 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