Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 Go_Po · Mar 06, 2020 at 10:55 PM · timeeuler

I have issuses with TimeDeltatime

I made a tilt for fps character (safer pick ups from the corners) and when moving with Q everything is fine. I mean the movement is slowing by Time.Deltatime, but when i am pressing the E button it fills that Time.Deltatime just dont work CODE: private void Tilt() {

     if (Input.GetKey(KeyCode.Q))
     {
        playerController.transform.rotation *= Quaternion.Euler(0, 0, 20 * Time.deltaTime * 10);

       Quaternion t = playerController.transform.rotation * Quaternion.Euler(0, 0, 20  * Time.deltaTime * 10);

         if (t.eulerAngles.z > 20)
         {
             t = Quaternion.Euler(t.eulerAngles.x, t.eulerAngles.y, 20);
         }

         playerController.transform.rotation = t;

     }
     else if (Input.GetKey(KeyCode.E))
     {
         
         playerController.transform.rotation *= Quaternion.Euler(0, 0, -20 * Time.deltaTime);

         Quaternion t = playerController.transform.rotation * Quaternion.Euler(0, 0, -20 *Time.deltaTime);
         if (t.eulerAngles.z > 20)
         {
             t = Quaternion.Euler(t.eulerAngles.x, t.eulerAngles.y, -20);
         }

         playerController.transform.rotation = t;
     }

     else
     {
         playerController.transform.rotation *= Quaternion.Euler(0, 0, 0 * Time.deltaTime * 10);

         Quaternion t = playerController.transform.rotation * Quaternion.Euler(0, 0, 0 * Time.deltaTime * 

10); if (t.eulerAngles.z > 0) { t = Quaternion.Euler(t.eulerAngles.x, t.eulerAngles.y, 0); }

         playerController.transform.rotation = t;

     }
 }
Comment
Add comment · Show 1
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 RobAnthem · Mar 06, 2020 at 11:46 PM 0
Share

A good rule of thumb: do not read from eulers, only read ONCE and then store that vector to alter and write to them. They flip at -180 and 180 so it's going to give erroneous results. I can almost guarantee that is your problem here.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Mar 07, 2020 at 02:59 AM

Uhm inside your "Q" code you multiply 200 (20 * 10) by deltaTime however inside your "E" code you only muliply 20 by deltaTime. Is that the difference you're seeing? If that's the case you really should pay more attention to your code.

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
avatar image
0

Answer by Go_Po · Mar 09, 2020 at 01:11 AM

@Bunny83 Well actually this multiply by 10 is kind of mistake but even when I fixed my stupidity its just doesnt change. Every thing is just the same which doesnt make sense for me

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

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

How to create an agenda or timetable system? 1 Answer

Animation Window: How to scale keyframes to increase time? 9 Answers

Minute Timer Issue 1 Answer

Unity and music tracks - load track at certain point and fading tracks in and out 1 Answer

weapon bobbing 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