void MoveInput() { //jump if character is grounded and Jump key is pressed if (Input.GetButton(KeyJump)) { mBox.Jump(); } if (Input.GetButtonDown(KeyRoll)) { mBox.Roll(); } if (Input.GetButtonDown(KeyItem)) { mBox.UseItem(); } /////////////////////////////////// h = 0; v = 0; if (!mBox.acting) { h = Input.GetAxis(KeyHorizontal); v = Input.GetAxis(KeyVertical); } bool tempkeyHAxis = (h > 0.0f); bool tempkeyVAxis = (v > 0.0f); //if(resettingCamera && (Mathf.Abs(h-tempH) > 0.1f || Mathf.Abs(v-tempV) > 0.1f)) if (resettingCamera && ((keyH != Input.GetButton(KeyHorizontal) || keyV != Input.GetButton(KeyVertical)) || (tempkeyHAxis != keyHAxis || tempkeyVAxis != keyVAxis) )) { resettingCamera = false; Debug.Log("resettingCamera:: false"); //h = 0.0f; //v = 0.0f; } //calculate move vector and pass to boxcontroller if (mCamera != null) { if (!resettingCamera) { cameraFoward = Vector3.Scale(mCamera.forward, new Vector3(1, 0, 1)).normalized; cameraRight = Vector3.Scale(mCamera.right, new Vector3(1, 0, 1)).normalized; } moveVector = v * cameraFoward + h * cameraRight; } else { moveVector = v * Vector3.forward + h * Vector3.right; } mBox.Move(moveVector, Input.GetButton(KeySprint)); ////////////////////////////////// }