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 /
This question was closed Mar 10, 2017 at 12:32 PM by Eglarist.
avatar image
1
Question by Eglarist · Feb 21, 2017 at 02:24 PM · physicsfixedupdatetimescalehingejoint

Physics calculations vs TimeScale vs FixedDeltaTime

Hello everybody!

I've looked at the documentation and searched for quite a few posts without a solution..

PROBLEM: it's possible modify physics timeScale & fixedDeltaTime (Pause Game) without causing all the hingeJoints gone crazy? :(

  1. If i only change timeScale (not fixedDeltaTime) all stuff movement in fixedUpdate() like camera, characters, etc... moves choppy in slowtime.

  2. If i change timeScale and proportionally fixedDeltaTime (as Unity documentation recommends) ...all stuff moves smoothly and nice in slowtime BUT physics on hingeJoints gets an unstable shake because change of "gravity vs physics calculations (solver)" not working as expected.

Please, any advice? Thanks!

https://youtu.be/BdBox6P1u6Y

 float xTime = 1.0f;
 
 void Update(){
     Time.timeScale = xTime;
     Time.fixedDeltaTime = 0.01F * xTime;
 }
 
 public void pauseTime(){
     xTime = 0.0000001f;
 }
 
 public void slowTime(){
     xTime = 0.2f;
 }
 
 public void normalTime(){
     xTime = 1.0f;
 }


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

  • Sort: 
avatar image
1

Answer by Daemonhahn · Feb 21, 2017 at 05:01 PM

never change fixed delta time, fixed delta time is meant to be used by the entire physics engine to work out physics calculations and doing this will throw everything off.

Comment
Add comment · Show 2 · 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 Eglarist · Feb 21, 2017 at 05:15 PM 0
Share

Setting the "fixedDeltaTime" according to timescale is recommended by the Unity documentation. If you didn't ..you will get a choppy effect.

Taking the fixedDeltaTime to 0.005f (ins$$anonymous$$d of 0.2f by default) reduces the issue. It was very slow and not enough to calculate the physiques in the hingeJoints in time to compensate for gravity. I have also opted to separate the timescale change (applied in function Update) from the proportional setting of fiexDeltaTime (applied in FixedUpdate function)

I'm doing tests to check the reaction of the physics engine to all these variables. I also checked to increase in ProjectSettings / Physics the speed of the solver, iterations, etc ... (does not seem to matter much).

The key seems to be in the fixedDeltaUpdate, in finding a value that moves everything correctly without consu$$anonymous$$g the performance.

avatar image Eglarist · Feb 21, 2017 at 06:53 PM 0
Share

For "pause" case (timeScale = 0) it's ok, without changing fixedDeltaTime no issues appear. And as there are no objects in motion during the pause they can not see moving choppy.

But my question is about solving when physics I want to get a superslowtime effect with things moving, altering timescale without the physics going crazy.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Hinge Joints Ignoring Angular Velocity? 0 Answers

Force physics collision calculation (forced fixed update) 0 Answers

Setting fixeddeltatime depending on TimeScale makes physics behave weirdly 1 Answer

Is it okay to use ForceMode.VelocityChange in Update()? 1 Answer

Hinge Joint Breaks When LocalScale is Changed 3 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