【Unity3d工作日志】模型动画播放(二)

需求:播放的模型能够上下左右移动,放大缩小

左右移动
mCamera.transform.RotateAround(mRotatePoint.position,mCamera.transform.up,mRightSpeed * Input.GetAxis("Mouse X");

上下移动
mCamera.transform.RotateAround(mRotatePoint,position,mCamera.transform.right,mUpSpeed * Input.GetAxis("Mouse Y");
放大缩小
        //里滑
        if(Input.GetAxis("Mouse ScrollWheel") < 0)
        {
            if(mAnimationCamera.GetComponent<Camera>().fieldOfView <=100)
            {
                mAnimationCamera.GetComponent<Camera>().fieldOfView += 2;
            }
            if(mAnimationCamera.GetComponent<Camera>().orthographicSize <= 20)
            {
                mAnimationCamera.GetComponent<Camera>().orthographicSize += 0.5f;
            }
        }

        //外滑
        if(Input.GetAxis("Mouse ScrollWheel") > 0)
        {
            if (mAnimationCamera.GetComponent<Camera>().fieldOfView > 25)
            {
                mAnimationCamera.GetComponent<Camera>().fieldOfView -= 2;
            }
            if (mAnimationCamera.GetComponent<Camera>().orthographicSize >= 1)
            {
                mAnimationCamera.GetComponent<Camera>().orthographicSize -= 0.5f;
            }
        }

猜你喜欢

转载自blog.csdn.net/itsxwz/article/details/80325463