Beispiel #1
0
 /*
     Get keyboard input and store current action according to key stroke
     R = ROTATE;
     Z = ZOOM;
     M = MOVE;
     SPACE = NO_ACTION;
 */
 private void GetInputForAction()
 {
     if (Input.GetKeyDown(KeyCode.R))
     {
         currentAction = InteractiveObjectAction.ROTATE;
     }
     else if (Input.GetKeyDown(KeyCode.Z))
     {
         currentAction = InteractiveObjectAction.ZOOM;
     }
     else if (Input.GetKeyDown(KeyCode.M))
     {
         currentAction = InteractiveObjectAction.MOVE;
     }
     else if (Input.GetKeyDown(KeyCode.Space))
     {
         currentAction = InteractiveObjectAction.NO_ACTION;
     }
     else if (Input.GetKeyDown(KeyCode.Escape))
     {
         //decide if keep currentaction or just reset.
         currentAction = InteractiveObjectAction.NO_ACTION;
         ResetObjectState();
     }
 }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        // lastMousePosition = Input.mousePosition;
        objectInitialState = new SavingTransform();
        objectInitialState.Position = new Vector3(transform.position.x, transform.position.y, transform.position.z);
        objectInitialState.Rotation = new Quaternion(transform.rotation.x, transform.rotation.y, transform.rotation.z, transform.rotation.w);
        objectInitialState.Scale = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z);

        objectZoom = transform.localScale;
        currentAction = InteractiveObjectAction.NO_ACTION;
    }