Unity3D, unity

Source: Internet
Author: User

Unity3D, unity

Recently, Unity3D provides Time. timeScale support for animation and special effects during combat. However, timeScale provides global time scaling, and some of our actions or animations do not want to be slowed down by timeScale. For example, when playing big moves in the legend of the turret, all other actions/animations except the big moves are paused.

The following are the ignoreTimeScale methods for Animation, Animation, and particle effect.

Animation

The Time. realtimeSinceStartup record is the real Time not affected by timeScale. It is used to play Animation at each frame sampling. The code snippet is as follows:

AnimationState animState = animation [clipName]; // The current animation state curTime = Time. realtimeSinceStartup; // current real time deltaTime = curTime-lastFrameTime; // The time interval between this frame and the previous frame lastFrameTime = curTime; // record the time of this frame, the next frame uses progressTime + = deltaTime; // animState of the animation playback time. normalizedTime = progressTime/currState. length; // animation normalization time [0-1] animation. sample (); // Sample the animation in the current state. This parameter is used when you want to explicitly set the animation state and Sample it.
Animator
Animator _ animator =...; public void Update () {_ animator. updateMode = AnimatorUpdateMode. UnscaledTime; // specify that the Update mode of the Animator is not affected by scale}
Particle effect
ParticleEmitter _emitter = ...;public void Update() {    _emitter.Simulate(Time.unscaledDeltaTime);}
For
ParticleSystem _particleSystem = ...;public void Update() {    _particleSystem.Simulate(Time.unscaledDeltaTime, true, false);}

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.