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
1
Question by Ozzyel-PT · Sep 13, 2013 at 07:55 PM · playerpause

Slow motion everything but player.

Hello.

I want to "slow motion time" on every object in the scene including physics and scripts, but also want my player character (rigidbody) continues normal movement. I've used things like sending pause messages: Player script:

     if (Input.GetMouseButton(1)){
         var objects : Object[] = FindObjectsOfType(GameObject);
             for (var pause : GameObject in objects) {
             pause.SendMessage ("ScriptPaused", SendMessageOptions.DontRequireReceiver);
         }
     }
 }

Another object script:

 private var paused : boolean;
  
 function ScriptPaused(){
     paused = true;
 } 
 function Update (){
     if (!paused) {
         // script
     }
 }

Also setting objects kinematic to true and pausing mecanim animations. It works fine in pause, but I want to know if it's possible use Time.timeScale to slow motion specific objects or create my own deltaTimes and how's Fixed and LateUpdate affected.

Thanks.

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
0

Answer by fafase · Sep 13, 2013 at 08:12 PM

I would guess you have everyone moving using Time.deltaTime. I fyou modify Time.timeScale you can modify the speed of execution, with 0 < timeScale < 1 you slow down all movement and animations since they are based on deltaTime which gets affected.

But your player will also slow down so you need to get him back to one.

you can easily put this one at the top of your player script, so that your player moves normal speed:

 if(slowDown){
     timeScale = 1;
 }

and then at the end you set it back for other scripts

 if(slowDown){
     timeScale = slowSpeed
 }

this way no big computation required and this will work as long as you do not have multi threading (I doubt you have anyway).

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 Ozzyel-PT · Sep 13, 2013 at 10:30 PM 0
Share

Thanks for your answer, but everything goes slow yet. I've tried different values and nothing, player keep going in slow speed (Animations, transform, physics):

     function Update(){
     if(slowDown) Time.timeScale = 1.0;
         if (Input.Get$$anonymous$$ouseButtonDown(1)){
             slowDown = !slowDown;
         }
     if(slowDown) Time.timeScale = 0.3;
 //All Script....
     }

I'm also using FixedUpdate in player script to move/rotate rigidbody.

avatar image fafase · Sep 14, 2013 at 08:14 AM 0
Share

I guess you also need a speed and a fastSpeed to multiply the velocity.

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

15 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

Related Questions

Play button & pause button activates at the same time, can not play the created scene 0 Answers

Play button & pause button activates at the same time, can not test the scene 1 Answer

Drop-down enum pauses player - must it be so? 1 Answer

Can someone help me with my player kill script? 0 Answers

Pause Menu Text Not Rendering 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