コード例 #1
0
        private void EasedLerpFactorExample()
        {
            // Get the world position of the mouse pointer
            Vector3 mousePositionWorld = Camera.main.ScreenToWorldPoint(Input.mousePosition);

            mousePositionWorld.z = 0f;

            // Set the runner position to the mouse pointer
            runner.position = mousePositionWorld;

            // Move the follower 75% of the remaining distance to the runner per second
            follower.position = UnityHelper.EasedLerpVector3(follower.position, runner.position, 0.75f);

            // ...which is the same as:

            //float t = MathHelper.EasedLerpFactor(0.75f);
            //follower.position = Vector3.Lerp(follower.position, mousePositionWorld, t);
        }