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 zak666 · Jul 06, 2016 at 01:42 AM · quaternionscriptingbasics

slow rotation over time?

Hi, I have a spaceship that flys around until it finds a target, trying to slow down the rate in witch it turns.. everything i have fun online tells me to use: transform.rotation = Quaternion.Slerp(this.transform.rotation, rotationA, Time.deltaTime * TurnSpeeed);

however no mater turn speed is 0.1f, 1, or 1000, it dose not make it slower. transform.rotation = Quaternion.Slerp(this.transform.rotation, rotationA, Time.deltaTime ); by its own is closer, but its still not turning slow enough, if their a more efficient way to slow this down?

 if (Newdirectionflighttimer < 1) {
                     randomDirection = new Vector3 (Random.value, Random.value, Random.value);
                     Newdirectionflighttimer = 12;
                 }
 
                 Quaternion rotationA = Quaternion.LookRotation(randomDirection);
             transform.rotation = Quaternion.Slerp(this.transform.rotation, rotationA, Time.deltaTime );
 
                 Newdirectionflighttimer -= 1 * Time.deltaTime;

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 Namey5 · Jul 06, 2016 at 03:31 AM 0
Share
 transform.rotation = Quaternion.Slerp (transform.rotation, targetRotation, Time.deltaTime * speed);

Should work fine if it's in one of the Update methods.

avatar image zak666 Namey5 · Jul 06, 2016 at 03:42 AM 0
Share

i alreadyy said this method doesn't change the speed of the rotation and yes its all in update.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by HarshadK · Jul 06, 2016 at 06:14 AM

You can actually lerp your speed variable that you use in Slerp.

Something like:

 float startSpeed;            // This should be greater than endSpeed in order for slow down.
 float endSpeed;
 
 void SlowDown()
 {
     Quaternion rotationA = Quaternion.LookRotation(randomDirection);
     float speed = Mathf.Lerp(startSpeed, endSpeed, Time.deltaTime);
     transform.rotation = Quaternion.Slerp(this.transform.rotation, rotationA, Time.deltaTime * speed);
 }

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

44 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

Related Questions

Storing camera angles for a FPS -1 Answers

Tilt object x degrees, smoothly 0 Answers

What is affected by the W in Quaternion(x,y,z,w)? 3 Answers

Use Euler angles for Quaternion variable in the Inspector 1 Answer

Rotate Issue 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