Implementing slow motion
Since Remedy Entertainment's Max Payne, slow motion, or bullet time, became a popular feature in games. For example, Criterion's Burnout series has successfully explored the slow motion effect in the racing genre. In this recipe, we will implement a slow motion effect triggered by the pressing of the mouse's right button.
Getting ready
For this recipe, we will use the same package as the previous recipe, BallGame
in the 1362_11_02
folder.
How to do it...
To implement slow motion, follow these steps:
- Import the
BallGame
package into your project and, from the Project view, open the level namedBallGame_01
. - In the Inspector, create a new tag Ball, apply this tag to prefab
ball
in thePrefabs
folder, and save the scene. - Add the following C# script BulletTime to First Person Controller:
using UnityEngine; using UnityEngine.UI; using System.Collections; public class BulletTime : MonoBehaviour { public float sloSpeed = 0.1f; public float totalTime = 10f...