统一平滑旋转和缩放

时间:2018-08-01 19:54:25

标签: c# ios unity3d lerp

下面是我的碰撞脚本的一部分,一切正常。

我试图弄清楚如何使“玩家”平滑旋转并缩小玩家对象的比例。我将如何处理?我是否应该创建一个检查变量并检查更新方法以进行平滑旋转,并且我对平滑缩放没有任何线索。任何帮助如何做到这一点将不胜感激。

if(blackholeActive == true){
        player.transform.Rotate(new Vector3(0, 0, Time.deltaTime * -150));
        player.transform.localScale = Vector3.Lerp(transform.localScale, new Vector3(0.025f, 0.025f, 0.025f), 0.01f * Time.deltaTime);
    }


// Black Hole Collision
    if (col.gameObject.tag == "BlackHole")
    {
        Debug.Log("Black Hole");
        int valC = coinCount;
        //coinCount = 0;
        int valS = starCount; // for stars lost text
        //starCount = 0;

        //Stop player from moving and falling and make them disappear into blackhole
        player.transform.GetComponentInChildren<Rigidbody2D>().bodyType = RigidbodyType2D.Static;
        player.GetComponentInChildren<Rigidbody2D>().velocity = Vector2.zero;
        player.GetComponentInChildren<Rigidbody2D>().gravityScale = 0;

        /// TODO: Stop Blackhole movement
        /// Make player spin and shrink
        blackholeActive = true;

        coinsLost.text = "Coins Lost: " + valC;
        starsLost.text = "Stars Lost: " + valS;
        gameOverCanvas.gameObject.SetActive(true);

    }

0 个答案:

没有答案