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
1
Question by Noxury · May 05, 2018 at 09:46 AM · joysticksmoothkeyboardtimescalegetaxis

Get smooth input when Time.timescale == 0

I've run into issue that I cannot gradually pan the camera when the game is paused with Keyboard Input. For some reason, Joystick Input returns float values from "GetAxis" even when Timescale is set to 0, but using WASD wont change. Changing to AxisRaw will work, but there is no smoothing anymore to both Joystick and Keyboard. How can this be solved without using Raw Input?

.

 Vector3 movementXZ = new Vector3 (
     Input.GetAxis ("Horizontal") * Time.unscaledDeltaTime, 
     Input.GetAxis ("Vertical") * Time.unscaledDeltaTime, 0);


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

Answer by Koyemsi · May 05, 2018 at 01:29 PM

I think this can't be done because of the timescale set to zero, because your scene is like "frozen in time". Even if the inputs are correctly read, nothing will happen unless your timescale becomes positive again. If you want any animation to go on after the player pressed a pause button, you should implement your pause differently. Perhaps one solution would be to :

  • manually disable all the scripts that control player, enemies and so on (you might have to store some info about their position and movement)

  • wait for your cam to finish its movement,

  • and only then, set the timescale to zero if you need to.

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 calpolican · Feb 05, 2019 at 08:20 AM 0
Share

This answer is wrong. He's using unscaled time! If you read the question you'll see he also mentioned that the the code already works for raw input. You can run many things while on pause, like animations and scripts, and yes, inputs too, but horizontal and vertical do seem to have a problem if they're not raw. Seems like a bug.

avatar image Koyemsi calpolican · Feb 05, 2019 at 01:42 PM 0
Share

You're probably right, and I admit I made a mistake. I was convinced that everything was like "frozen" when timescale was zero, but it seems to be wrong. So I have absolutely no idea of what's going on, talking about that smoothing issue. Sorry I couldn't help.

avatar image Kunrex120 calpolican · Jul 08, 2021 at 03:32 PM 0
Share

@calpolican no they're not wrong, you're the one who's partially wrong and no its not a bug

Input.GetAxis() is frame rate independent, which is a fancy way of saying Unity multiplies it by Time.deltaTime internally. When Time.timeScale is 0, deltaTime is 0 so the entire result of GetAxis is also 0. Don't believe me? take a look at the docs https://docs.unity3d.com/ScriptReference/Input.GetAxis.html

GetAxisRaw on the other hand is not frame rate independent thus it works.

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

87 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

Related Questions

Joystick Leftstick triggering Keyboard Horizontal Vertical 1 Answer

Input.GetAxis wont work with UI controls 0 Answers

joystick movement 2 Answers

If timeScale is lowered how can I aviod to get the physics simulation choppy? 2 Answers

Mobile Virtual Joysticks / Keyboard Script Conversion 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