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
0
Question by drudiverse · Apr 18, 2014 at 07:58 AM · quaterniontimefaster

Time.time rotation going faster and faster

this is a line just to spin a spacecraft round and round as it files forwards. The trouble is that it spins slowly at the start of game, and then it spins faster and faster and goes crazy fast. I just want it to spin at a constant rate:

transform.rotation = steerot * Quaternion.AngleAxis(Time.time*0.5, Vector3.forward);

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

1 Reply

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

Answer by _met44 · Apr 18, 2014 at 08:41 AM

Try using deltaTime instead of time, this way you should get a constant speed. With time the value is small at the beginning but it keeps going up obviously and that gets your ship rotating faster and faster.

 transform.rotation = steerot * Quaternion.AngleAxis(Time.deltaTime * 0.5, Vector3.forward);
Comment
Add comment · Show 3 · 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 drudiverse · Apr 18, 2014 at 09:54 AM 0
Share

hi met, Thanks, that's wrong though, because deltaTime is the time since the start of the last frame, it resets every frame.

I want the aeroplane to rotate through 360 degrees regularly over time, so Time.time sends AngleAxis angle 0-360, but it just goes faster and faster.

avatar image drudiverse · Apr 18, 2014 at 09:59 AM 0
Share

oh sorry i get the solution, the rotation is incremental anyway so if i call it for the same angle every frame it will increment over time.

  transform.rotation = steerot * Quaternion.AngleAxis(30, Vector3.forward); 

call it every frame

avatar image fafase · Apr 18, 2014 at 10:01 AM 0
Share

So you want to rotate 360 degrees over a defined duration but this is what you are given here.

Using:

 Quaternion.AngleAxis(360f, Vector3.forward);

Will rotate 360 per frame.

 Quaternion.AngleAxis(Time.deltaTime * 360f, Vector3.forward);

Will rotate 360 degrees per second

Now you can define your duration with

 public float duration = 2;// Full rotation over 2s
 private float f_duration = 1 / duration;
 Quaternion.AngleAxis(Time.deltaTime * 360f * duration, Vector3.forward);

See if you give a value like 5 for 5s you get 1/5 -> 0.2 so each time your given value is reduced by 5. If you want to speed up the rotation, you give 0.5 for half a second then you get 1 / 0.5 -> 2, and this will multiply the value by 2 hence increasing the rotation per frame and reducing the duration of the rotation.

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

21 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

Related Questions

Rotating around the Y axis then on Z axis makes my object rotate on the X axis 1 Answer

Instantiate objects faster and faster over game time,Instantiate objects faster and faster over time 1 Answer

Rotation question 1 Answer

How can i make my game go faster every 3 seconds? (Im not a Bot please answer me) 1 Answer

Quaternion.Slerp rotation speed increases over script life. 1 Answer


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