• 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 dissidently · Dec 29, 2010 at 10:11 AM · timeslowmotionramp

What's the best way to ramp slowmotion?

By ramping I mean progressively slow time down from full speed to full slow motion.

For example, if player hits the slow motion button, after the first hit time is variable (let's say .5x) slower than when she first hit the button. a variable of time later, (let's say 0.1 seconds), it's variable slower (again, let's say .5x) it's current speed until reaching slow motion state desired as set in another variable.

Currently I'm using this function to slow down time, but it's jarring, cause it goes from full speed to ultra slow motion in one jump:

var _slow_motion : boolean = false; var _max_slowmotion : float = 0.03125;

function Slowmotion (){
if (!_slow_motion){ Time.timeScale = _max_slowmotion; _slow_motion=true; }else { Time.timeScale = 1; _slow_motion=false; } }

function Update(){ if (Input.GetButtonDown("Jump")){ Slowmotion(); }

Ramping back up would be nice too, rather than jumping straight back to full speed.

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 wolfstien786 · Jul 27, 2013 at 07:13 PM

Use mathf.smoothdamp.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Time.timeScale not working 1 Answer

Game slows down after restart 1 Answer

Calcule Player's Speed based on Time.timeScale 1 Answer

Time.timeScale and Time.fixedDeltaTime 1 Answer

Slow motion all but one - yet another round, hopefully the last 6 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges