示例#1
0
    // Update is called once per frame
    void Update()
    {
        mousePos.x += Input_scr.GetCameraXMovement() * sensitivity;
        mousePos.y += Input_scr.GetCameraYMovement() * sensitivity;

        mousePos.x = Mathf.Clamp(mousePos.x, -32, 31);
        mousePos.y = Mathf.Clamp(mousePos.y, -31, 32);

        transform.localPosition = mousePos;
    }
示例#2
0
    void Update()
    {
        targetRotX += -Input_scr.GetCameraYMovement() * mouseSensitivity * Time.deltaTime;

        targetRotX = Mathf.Clamp(targetRotX, -clampAngle, clampAngle);
        rotX       = Mathf.LerpAngle(rotX, targetRotX, lerpSpeed);

        Quaternion localRotation = Quaternion.Euler(rotX, 0, 0.0f);

        transform.localRotation = localRotation;

        transform.localPosition = Vector3.Lerp(transform.localPosition, targetPos, 0.3f);
    }