其他分享
首页 > 其他分享> > Unity实现放大或缩小某个物体

Unity实现放大或缩小某个物体

作者:互联网

 bool ScaleObject(GameObject myObject, int type = 1, float offset = 0.1f)
        {
            switch (type)
            {
                case -1:
                    myObject.transform.localScale = new Vector3(myObject.transform.localScale.x / offset,
                                                                myObject.transform.localScale.y / offset,
                                                                myObject.transform.localScale.z / offset);
                    break;
                case 1:
                    myObject.transform.localScale = new Vector3(myObject.transform.localScale.x * offset,
                                                                myObject.transform.localScale.y * offset,
                                                                myObject.transform.localScale.z * offset);
                    break;
                default:
                    break;

            }
            return true;
        }

标签:myObject,物体,localScale,transform,break,Unity,offset,某个,Vector3
来源: https://www.cnblogs.com/ezhar/p/13594181.html