예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (!gm.sm.simOn) //Cloth Simulation Currently Off, can manipulate quantities
        {
            if (Input.anyKeyDown)
            {
                int newDimX = dimNX;
                int newDimY = dimNY;
                if (Input.GetKeyDown(KeyCode.F))
                {
                    if (newDimY > dimMin)
                    {
                        newDimY--;
                        newDimX--;
                    }
                }
                else if (Input.GetKeyDown(KeyCode.R))
                {
                    if (newDimY < dimMax)
                    {
                        newDimY++;
                        newDimX++;
                    }
                }
                meshChanged = meshChanged || (newDimX != dimNX || newDimY != dimNY);
                dimNX       = newDimX;
                dimNY       = newDimY;

                if (Input.GetKeyDown(KeyCode.Z))
                {
                    showShear   = !showShear;
                    meshChanged = true;
                }
                if (Input.GetKeyDown(KeyCode.X))
                {
                    showBend    = !showBend;
                    meshChanged = true;
                }

                if (Input.GetKeyDown(KeyCode.C))
                {
                    if (orientation == Vector3.right)
                    {
                        orientation = Vector3.up;
                    }
                    else if (orientation == Vector3.up)
                    {
                        orientation = Vector3.forward;
                    }
                    else
                    {
                        orientation = Vector3.right;
                    }
                    meshChanged = true;
                }
                if (meshChanged)
                {
                    UpdateMesh();
                }
            }

            if (mm.initPos != startPosition)
            {
                mm.initPos = startPosition;
                mm.ShiftMesh();
            }
        }
        else //Cloth Simulation Currently On
        {
        }
    }